Difference between Custom Settings and Custom Metadata - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
VIGNESH BALASUBRAMANIANVIGNESH BALASUBRAMANIAN 

Difference between Custom Settings and Custom Metadata

Hi Everyone,

Can you provide what are the differences between Custom Settings and Custom Metadata.

Thanks
Vignesh.B
Best Answer chosen by VIGNESH BALASUBRAMANIAN
Ashutosh TripathiAshutosh Tripathi
Hi Vignesh,

Well, I've found that in only a few cases in which Custom Settings more useful. Custom Metadata types have a number of advantages that make them the correct choice to implement almost always.

Advantages to Custom Metadata:

1. Most importantly, as stated before, they are Metadata and thus deployable! No more annoying configuration after deployment, which you have to do with Custom Settings. They're also refreshed to sandboxes, so you don't need to create Apex classes to generate your default Custom Setting records.

2. They have WAY more options that Custom Settings: picklist fields, long text areas (in Spring '17), page layouts, and validation rules (though as of Winter '17 these are not deployable either by change set or by migration tool - weird!)

3. The beauty that is Metadata Relationships! You can create lookups between Custom Metadata objects. Additionally, you can create an Object Definition lookup - so you're relating Custom Metadata to Standard or Custom Object definitions. Additionally, in Spring '17 you can create a dependent lookup to a Field Definition on that object. (Documentation here)

4. Custom Settings have the same permission to edit the records and to edit the configuration. Both can be done with the "Configure Application" permission. With Custom Metadata, you can edit the records with "Configure Application" but you require "Author Apex" to edit the configuration.

5. Custom Metadata types have a lot of additional features specific to developing managed packages. You can configure the visibility and editability of fields an objects both by the org that installs the package and by upgrades to the package.

Reason why you would use custom settings instead:
============
1. Hierarchies - Custom metadata types do not purport to replace hierarchy custom settings which allow you to vary values based on users and profiles across the org. These custom settings can also be referenced in formulas, so can be used in formula fields, validation rules, workflow rules, and visualforce. (Documentation here)

2. Web service credentials - If you’re using test credentials in a sandbox, you don’t have any reason to deploy them to production. More importantly, if you create a sandbox, you don’t want the config for the production versions of your Web Services being created automatically and used by default. However, it is usually best to use Named Credentials for this.

3. Custom setting records’ values can be edited in code, while custom metadata cannot. If you will need to modify your configuration programmatically for any reason (say you’re creating a config console for the user), custom metadata will not work.

Also please check the below information link on this topic:
https://www.xgeek.net/salesforce/using-custom-metadata-types-and-custom-settings-in-salesforce/

Please mark it as "Best Answer" right below the comment if it gives you idea regarding your solution, so that it will help others if they have similar issues in future.

 

All Answers

Rohit BRohit B
Hi Vignesh,
Custom Setting - Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, flows, Apex, and the SOAP API.
For more details, please follow below link:-
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_customsettings.htm

Custom Metadata - Custom metadata is customizable, deployable, packageable, and upgradeable application metadata. First, you create a custom metadata type, which defines the form of the application metadata. Then you build reusable functionality that determines the behavior based on metadata of that type. Similar to a custom object or custom setting, a custom metadata type has a list of custom fields that represent aspects of the metadata.
For more details, please follow below link:-
https://help.salesforce.com/articleView?id=custommetadatatypes_overview.htm&type=0
https://trailhead.salesforce.com/en/modules/custom_metadata_types

Hope it helps.. :)
Ashutosh TripathiAshutosh Tripathi
Hi Vignesh,

Well, I've found that in only a few cases in which Custom Settings more useful. Custom Metadata types have a number of advantages that make them the correct choice to implement almost always.

Advantages to Custom Metadata:

1. Most importantly, as stated before, they are Metadata and thus deployable! No more annoying configuration after deployment, which you have to do with Custom Settings. They're also refreshed to sandboxes, so you don't need to create Apex classes to generate your default Custom Setting records.

2. They have WAY more options that Custom Settings: picklist fields, long text areas (in Spring '17), page layouts, and validation rules (though as of Winter '17 these are not deployable either by change set or by migration tool - weird!)

3. The beauty that is Metadata Relationships! You can create lookups between Custom Metadata objects. Additionally, you can create an Object Definition lookup - so you're relating Custom Metadata to Standard or Custom Object definitions. Additionally, in Spring '17 you can create a dependent lookup to a Field Definition on that object. (Documentation here)

4. Custom Settings have the same permission to edit the records and to edit the configuration. Both can be done with the "Configure Application" permission. With Custom Metadata, you can edit the records with "Configure Application" but you require "Author Apex" to edit the configuration.

5. Custom Metadata types have a lot of additional features specific to developing managed packages. You can configure the visibility and editability of fields an objects both by the org that installs the package and by upgrades to the package.

Reason why you would use custom settings instead:
============
1. Hierarchies - Custom metadata types do not purport to replace hierarchy custom settings which allow you to vary values based on users and profiles across the org. These custom settings can also be referenced in formulas, so can be used in formula fields, validation rules, workflow rules, and visualforce. (Documentation here)

2. Web service credentials - If you’re using test credentials in a sandbox, you don’t have any reason to deploy them to production. More importantly, if you create a sandbox, you don’t want the config for the production versions of your Web Services being created automatically and used by default. However, it is usually best to use Named Credentials for this.

3. Custom setting records’ values can be edited in code, while custom metadata cannot. If you will need to modify your configuration programmatically for any reason (say you’re creating a config console for the user), custom metadata will not work.

Also please check the below information link on this topic:
https://www.xgeek.net/salesforce/using-custom-metadata-types-and-custom-settings-in-salesforce/

Please mark it as "Best Answer" right below the comment if it gives you idea regarding your solution, so that it will help others if they have similar issues in future.

 
This was selected as the best answer
VIGNESH BALASUBRAMANIANVIGNESH BALASUBRAMANIAN
Thank you guys 
Daniel CortesDaniel Cortes
Hello Ashutosh.
The answer you provided has been posted in another forum verbatim:
https://salesforce.stackexchange.com/questions/74049/what-is-the-difference-between-custom-settings-and-custom-metadata-types/183733#183733

Can you please confirm who is the original poster of this solution?
Thank you.
Abhilash KuntarAbhilash Kuntar

Ashutosh, you should have given credits to the original guy who posted the answer. Copying is fine, but should have mentioned the same.

https://salesforce.stackexchange.com/questions/74049/what-is-the-difference-between-custom-settings-and-custom-metadata-types -- this has good discussion too (please beware of latest updates to the custom metdata, these discussions are old).

--
Abhi.

Nubika AdminNubika Admin
Thank you so much! Was very helpful to decide