Home SalesforceInterview Question Difference between Custom Setting and Custom Metadata Type

Difference between Custom Setting and Custom Metadata Type

by Dhanik Lal Sahni

Custom Setting and Custom Metadata Type are used to store application secrets. We can use both of them to store the application’s configuration data. Although both are used to store configuration data, both have different use cases.

Similarity of Custom Metadata Types and Custom Settings

  1. Both custom settings and metadata types avoid governor limits. If we use SOQL to get custom settings then the Governer limit will be enforced. If we use the custom setting method to query, then it will bypass the governor limit
  2. Both can be used to store encrypted data.
  3. Both are internally cached, so it will help us in better-performing applications.
  4. Both can be used in the formula field.
  5. We can not create tabs for both

Difference between Custom Metadata Types and Custom Settings

Sr#Custom SettingCustom Metadata Type
1Only metadata of custom settings is deployable. We have to create a configuration record post-deployment.Custom metadata types are deployable. We can deploy all configuration records to any org. These are also created using Org Refresh.

2.
Custom Setting supports a hierarchy so that we can create different data based on the user and profile
Custom metadata types do not support data for profile/user/permission sets directly but we can control visibility using Enhanced Profile User Interface
3.Custom setting records’ values can be edited in codeCustom metadata cannot be edited in code. Custom metadata is metadata, not a record, so we can only deploy metadata or change it using setup. It supports record modification only in the Manage Package and within the same namespace.
4.
It does not support lookup relationships with another custom setting
Can be set to a lookup relation with another custom metadata.
5.Cannot use the validation rule and page layout.Can set validation rules and page layouts.
6.Supporting few basic data types and not supporting picklist, text area, or lookup fieldsWe can create picklist fields and a long text area and add validation rules to it.

Where Custom Metadata Types should be used

  1. Custom metadata types are configurable data objects; therefore, we should use them where application configuration is not changing between Orgs.
  2. We should use it in AppExchange product to add configuration data. We can give functionality to edit records to the app’s consumer as well using its visibility setting.

Where Custom Setting should be used

  1. It should be used when we have to configure different data for different org like API URLs which will be different for different org etc.
  2. We should use it when we want to configure different data for a different set of users/profiles.

References:

Related Posts:

You may also like

4 comments

What are Salesforce Big Objects? - SalesforceCodex July 18, 2022 - 5:05 am

[…] Custom Setting and Custom Metadata Type […]

Reply
Salesforce Architect Interview Questions - Salesforce Codex March 6, 2024 - 4:44 am

[…] out the post-Custom Setting and Custom Metadata Type to understand the both […]

Reply
Questions for Tech Lead/Salesforce Architect Interview May 15, 2024 - 12:37 am

[…] Interview QuestionsSalesforce Apex Interview QuestionTypes Of Integration Patterns in SalesforceDifference Between Custom Setting and Custom Metadata TypeWhat is PK Chunking?What is Data […]

Reply
Can the future method be executed from batch Apex? November 19, 2025 - 2:24 pm

[…] Custom Setting and Custom Metadata Type […]

Reply

Leave a Comment

Top 10 Flow Enhancement in Spring’25 Release Top 10 Salesforce Service Cloud Features Top 10 Best Practices for Lightning Flow Facts and Statistics for Salesforce’s Size and Market Share Top 5 Contract Management Salesforce Apps