0

I have a salesforce app and push the code on scratch orgs. Its working fine and Custom Metadata Types are created successfully.

I packaged and promoted the app successfully using ISV account.

then I tried installing the app on new environment org, the app is installed successfully but its not creating any Custom Metadata Types. This new scratch org is basically created by Environment Hub, developer edition.

Is there anything, am I missing that causes the orgs not to create Custom Metadata Types.

Edit 1

When installing using UI, the Custom Metadata Types not installing.

4
  • Are the Custom Metadata Types packaged? Are they marked as Protected? Or are you attempting to call the Metadata API to actually create metadata?
    – David Reed
    Mar 4, 2020 at 13:45
  • @DavidReed I Custom Metadata Types are written in xml file and placed under objects directory. Yes, it is marked as Protected. No, I am not calling Metadata API to create instead to create/modify its record.
    – Rafee
    Mar 5, 2020 at 6:33
  • Thanks for clarifying, @Rafee. I'm not sure I understand what the problem is; are you saying that when you install your package, it is not including records of your Custom Metadata Type? Are you trying to package those records?
    – David Reed
    Mar 5, 2020 at 6:37
  • @DavidReed Problem : when I push the source to scratch org, the Custom Metadata Type is created and its working fine. But when I package, promote and tried to install on another org created using Environment Hub (basically ISV account) then Custom Metadata Type is not created.
    – Rafee
    Mar 5, 2020 at 6:47

1 Answer 1

2

Protected Custom Metadata Types are not visible in the subscriber org:

When a custom metadata type is package-level protected using 2GP, records are only accessible from code within that managed package. Also the subscriber, and other packages, even within the same namespace, can’t access the custom metadata type or its records.

That's the intended behavior for protected Custom Metadata Types. If you want the type to be available in the subscriber org, but to hide specific records, protect and package the records rather than protecting the type itself.

2
  • I changed the visibility to PackageProtected still its not creating when I am trying to install using UI. But push the source code, its created.
    – Rafee
    Mar 5, 2020 at 9:56
  • @Rafee When you push a package containing PackageProtected CMTs, you can't see the CMTs in the target org. That's the purpose of protection. You can see them only when you perform an unmanaged deploy into a scratch org.
    – David Reed
    Mar 5, 2020 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .