Here's the situation:
- We have a Lightning App that reads from a Custom Metadata Type to populate a settings/configuration page.
- Then you can edit the page and click save and that will create a
Metadata.CustomMetadataobject with containing details (such as fullName and Label, along with the configuration fields) which it then sends to
This all works perfectly in an unmanaged environment (Both namespaced and not). Once it's put into a managed package though, the behavior becomes strange. Instead of updating the record with the package's namespace, it instead makes a new record without any namespace (or with the namespace of the local org if ther is one).
So our product is looking at the namespaced record for it's configurations. I am able to manually edit the namespaced one (It's not protected, either the object or the record) but whenever the app tries to update it, it makes a new record. Second and third updates change this newly created record as well (it doesn't always make new records).
The question here is:
How do I assign a namespace to the Metadata object records. We tried
NameSpace__value as the MasterLabel and that just saved all in one string, making
NameSpace__value the MasterLabel. We tried writing directly to the NamespacePrefix field and it responded with a "no such field" error. We got the same error when trying to write to DeveloperName.
I'm not including code here but it's as simple as could be, because it works fine in all non-packaged tests, I just need to know how to assign a namespace to the Custom Metadata Type record.
Thank you for your time an assistance in this.