I am developing my first managed package where the default installation will be free and will provide access to some data. And if a user wants to go Paid, he will have access to additional data. Currently the user details (id, password, client id, client secret, cryptokey) all are in some Custom Metadata Settings marked "Protected". The CMS fields are "Upgradeable".

But if the components are to be marked thus, I have to upgrade the package to make the user upgrade to some superuser. And then anyone who installs the package will get the superuser access.

Obviously this is wrong. So should I make the CSM "Un-Protected" and when a user pays for the superuser, should I simply provide the superuser details and ask him to upgrade the CSM in his org?

I am deep diving into the ISVForce developer guide but so far not able to get a brief theory of how it should work. Any pointer will be much appreciated.


2 Answers 2


You can try something along these lines if you want to keep your solution entirely within your package.

The licensing system my company uses involves communicating with an external server to authorize access. In my company's case, we use our own salescloud org.

On the server, you can keep a list of users who have paid for your product, and in your managed package code, make a request to the server asking whether or not the current org is on that list.

If the server responds with a yes, then you can allow access to your paid functions/data. In your case, it sounds like you would modify your custom metadata to give the user superuser access.

You can add a button somewhere in your interface to allow customers to send a request to the server so that all you have to do once you update their information on your end is tell them to press the button.

This does involve creating the server code to store your information and handle requests, so do keep that in mind.

  • okay that is along my lines, we already have a server where we can manage the list of users. It will be simpler enough to handle as we have a tight deadline. thanks Michael:) Mar 6, 2018 at 11:35

The new Apex Metadata API may help with this. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata_security.htm

It should now be possible for your packaged code to not only access but create and update protected metadata records.

Also I honestly don't know enough about this yet but Feature Management is a thing now. https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/fma_types_objects.htm

  • thanks for pointing me towards these but honestly seems it needs a bit of reading and we don't have enough time. I will come back to this once we do manage to release at least one version of our Package. Thanks anyway:) Mar 6, 2018 at 11:36

You must log in to answer this question.

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