We are working on an application in managed package, and we need to store app configuration. Generally, we want to allow users to turn on/off some features in our app. For example, on the settings page (visualforce page) there will be a checkbox "Allow <something>"
that users would use to enable/disable functionality that our app provides.
What we need basically is:
- Have a set of default settings for an application (this should be available right after the app was installed)
- Allow end users (in a subscriber org) change those default settings at any time
So there are quite a few options how we can address this: (1) constants in apex class; (2) custom objects; (3) custom settings; (4) custom metadata types.
While all of these options can get us what we need, Custom Metadata Types seems a better choice. It's newer than Custom Settings, more flexible, and its values can be shipped with application directly, reducing the need apex install scripts to populate values. Still Custom Metadata Types has some limitations, e.g. record values cannot be updated in Apex (or am I wrong here?).
Hence I have several questions:
- This is a high level question concerning design and architecture overall: What is a common approach to store app settings for a managed package application? Are there any design patterns?
- If Custom Metadata Types was our go-for option, how would we update record values? Taking my example above, how would I store the value of
"Allow <something>"
checkbox to the database?