Which one to pick – Custom Settings or Custom Metadata Types?
What would you prefer when you are building a custom application and it requires configurable data – Custom Settings or Custom Metadata Types (CMD)?
The obvious answer to this would be Custom Metadata types due to the various advantages that it has over Custom Settings. However, Custom Settings also has its own reasons to hold its place in the salesforce space. We need to understand the exact scenario to decide the best fit.
Here in this blog we will try to analyze few scenarios that would help us understand the purpose for both. But before we move there, here is a quick snapshot of some of the pros and cons of each.
Looking at the list of benefits that Custom Metadata Types provides, we are inclined towards using Custom Metadata types. But there are obvious use cases where Custom Settings can still be used. Let us look at couple of scenarios for each and understand its real purpose.
Custom Metadata Types
- Building a Product which is dependent on some pre-defined data.
- Load of data during installation of managed package.
- Configurable data that does not change
- Metadata as part of an application that needs to be deployed along with the application.
- Hide the Metadata of your application from the end user and would like to restrict it from edited.
Custom Settings
- Custom Application which has configurable data that requires periodic change that is turning on/off of certain settings.
- Configuration data that is customer specific and not application specific.
- Configurable data as per Hierarchy
- Configurable data that needs to be updated/created through Apex.
As the name itself suggest, one is a setting for which you would like to give the flexibility to change and the other one is metadata based on which an entire application runs and is core to the product/application just like our Custom Objects and fields. So, you have to extra cautious when changing metadata and hence lot of restrictions.
Although, Salesforce has not highlighted anything regarding new features or roadmap for Custom Settings, but Custom Metadata Type definitely is in the limelight. Since, it is an era of Meta driven architecture, there is lot that can be achieved using Custom Metadata types when you would like use force.com as your development platform. Not sure, if Custom Settings are going to be the neglected child and might eventually phase out.
The two importable things that stands out in Custom Settings is the ability to create Hierarchical data and settings data that can go thru change.
Here are some of new and upcoming features for CMD.
- Defining Relationships (Winter 17)
- Bulk Create/Update Metadata Records using Custom Metadata Loader (Winter 17)
- Support for Translation Workbench (Roadmap)
- Customizable save process using Dynamic Triggers (Roadmap)
- Custom Tooling and automated setup via Apex DDL (Roadmap)
- Custom Datatypes for fields (Roadmap)
We will have to wait and watch what lies in future but definitely we loved Custom Settings when it was first launched as it was the only way for us to configure configurable data and gave us a level of abstraction to design our application. I still do use Custom Settings but definitely prefer Custom Metadata Types because it is an ideal solution for product development.
As every product has its own shell life and takes a makeover just like Lightning Experience, same might happen with Custom Settings. Till then choose the right option and Happy Coding!!
References
- http://www.slideshare.net/developerforce/beyond-custom-metadata-types
- http://resources.docs.salesforce.com/204/13/en-us/sfdc/pdf/custom_metadata_types_impl_guide.pdf
- https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_forcecom_development_custom_metadata.htm