0

I want to have a custom metadata type with no custom fields because I will use the MasterLabel as an email address with a validation rule that forces a valid email address. I want to package this in a 2nd generation package. I need the customer/subscriber to be able to add records to the CMT so they have control of who will receive emails from the application.

  1. Is this possible? If yes, what is the best answer below?
  2. What is the best setting at the CMT object level when I create it? a. All Apex code and APIs can use the type, and it's visible in Setup. b. Only Apex code in the same namespace can see the type. The name of the type and the record are visible if they're referenced in a formula. c. Only Apex code in the same managed package can see the type. The name of the type and the record are visible if they're referenced in a formula.

Thank you

2
  • I don't see why new records cannot be added to the CMT if the users have access to the object. Keeping it 'PackageProtected' would be the best for security IMO. Nov 14 '21 at 4:52
  • Hi - you and David are giving me tw different answers. What you said makes sense but I know SF packaging can be finicky. Are you certain or just an assumption? Thanks
    – TomB
    Nov 25 '21 at 3:49
0

Is this possible?

Yes.

What is the best setting at the CMT object level when I create it? a. All Apex code and APIs can use the type, and it's visible in Setup. b. Only Apex code in the same namespace can see the type. The name of the type and the record are visible if they're referenced in a formula. c. Only Apex code in the same managed package can see the type. The name of the type and the record are visible if they're referenced in a formula.

If you want your users to be able to directly create CMT records in Salesforce Setup, you must choose (a), an unprotected type. If you plan to provide a custom user experience to support management of CMT records, you may select (b) or (c).

1
  • David you and LoveBomber77 have different answers. Have you experienced this first hand and know? I am only asking because I have two different answers and SF packaging can be finicky. Thanks
    – TomB
    Nov 25 '21 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.