0

I'm new to Salesforce. I'm trying to retrieve all the packages installed in my org programmatically with the use of Metadata. Now, I have created a custom metadata type and have created few custom fields inside it. How is the process of grabbing the details from the PackageLicense fields (like Status & NamespacePrefix) to the custom fields in my custom metadata type?

1 Answer 1

0

Custom Metadata Types are not a tool for data retrieval. They are used to store and migrate persistent data, typically application configuration data.

Information retrieved through SOQL can be stored in Custom Metadata Types through the use of the Apex Metadata API. Custom Metadata records can be retrieved by Apex code, once created, by performing a SOQL query.

Because Custom Metadata Types cannot be deleted in Apex, and because they're manipulated through an asynchronous, deployment-based API, it's more common to utilize Custom Settings to store application data that must regularly be updated or which isn't deployed as part of an application.

Because installed package details are part of the organization's metadata anyway, it may not be worthwhile to persist these details to Custom Settings or Custom Metadata. If the data that's being gathered is intended for use purely within Apex, Visualforce, or REST services, building an Apex wrapper class is more likely to be a good solution.

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.