I have a feature that updates page layouts using the Apex Metadata API. When we are testing it when it is installed, the deployment fails when trying to update a field on that custom metadata type. Reading through the documentation it seems like I would be able to do this. The packaged custom metadata records and the Apex code are in the same namespace. Has anyone ran into this?


I figured it out. It is because the custom metadata field that I was trying update had a field Manageability of Upgradable. Changing that to Subscriber editable was the solution

| improve this answer | |
  • I have similar requirements: In my managed package, I need to add custom metadata type which I want to be updateable only by my packaged apex code (calling one global method of my package from anonymous window console from subscriber org). My configuration for custom metadata type is : Type is protected, field manageability is 'subscriber-editable' and record itself would be protected as well. I am adding initial record as part of package then want to update that record using apex. Would that work? – balinder singh Oct 31 '18 at 21:21
  • I have similar issue, can you help : salesforce.stackexchange.com/questions/253867/… – Abhishek Mar 14 '19 at 14:33

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.