Skip to content
  • Home
  • All Blogs
  • LWC
  • Apex
  • Interview
  • About Us
Custom Settings vs Custom Metadata

Custom Settings vs Custom Metadata: All You Need to Know for Salesforce Success in 2025

January 19, 2025December 25, 2024 by ApexVine

If you’re a Salesforce admin or developer, understanding the differences between Custom Settings and Custom Metadata is crucial. These tools store configuration data, but their fields and capabilities vary significantly. Here’s a detailed comparison to help you choose the best one for your needs.

Table of Contents

  • Custom Settings Fields
  • Custom Metadata Fields
    • Key Differences in Fields Between Custom Settings and Custom Metadata
    • Detailed Feature Comparison Table
      • When to Choose Custom Settings vs Custom Metadata?
    • Conclusion

Custom Settings Fields

Custom Settings are designed to store application configuration data that can be accessed quickly without SOQL queries. There are two types of Custom Settings: List Custom Settings and Hierarchy Custom Settings.

Fields Available in Custom Settings

Custom Fields:

  • You can create fields in Custom Settings to store configuration data.
  • Supported field types:
    • Checkbox: Boolean values (true/false).
    • Currency: Stores monetary values.
    • Date: Stores calendar dates.
    • DateTime: Stores date and time values.
    • Email: Stores email addresses.
    • Number: Stores numeric values (with or without decimals).
    • Percent: Stores percentages.
    • Phone: Stores phone numbers.
    • Text: Stores plain text.
    • Text Area (Long): Stores longer text (up to 131,072 characters).
    • URL: Stores web addresses.

Protected Fields:

  • You can mark fields as protected, ensuring they cannot be accessed by managed package subscribers.

Label and Description:

  • Each Custom Setting field has a label and description for easier identification and use.

Additional Features of Custom Settings

Access Methods:

  • Custom Settings data is cached, allowing fast access through Apex or Visualforce without consuming SOQL queries.

Example in Apex

MyCustomSetting__c setting = MyCustomSetting__c.getInstance('CustomKey');
  1. Data Storage:
    • Custom Settings store their data in records, similar to how you store records in an object.
  2. Visibility:
    • Accessible through user profiles and field-level security.
  3. Hierarchy Custom Settings:
    • These provide data at multiple levels (organization, profile, or user level), automatically applying the most specific value based on the hierarchy.

Custom Metadata Fields

Custom Metadata Types are a more robust and deployable alternative to Custom Settings. They are used to store metadata configuration and are part of your Salesforce metadata, meaning they can be packaged and deployed across environments.

Fields Available in Custom Metadata

Custom Fields:

  • Similar to Custom Settings, Custom Metadata Types support custom fields.
  • Supported field types:
    • Checkbox: Boolean values (true/false).
    • Date: Stores calendar dates.
    • DateTime: Stores date and time values.
    • Email: Stores email addresses.
    • Number: Stores numeric values (with or without decimals).
    • Percent: Stores percentages.
    • Phone: Stores phone numbers.
    • Text: Stores plain text.
    • Text Area (Long): Stores longer text (up to 131,072 characters).
    • URL: Stores web addresses.
    • Picklist: Dropdown menu with predefined options.
    • Relationship Fields: Create relationships with other objects or metadata types.

Protected Fields:

  • Fields in Custom Metadata can also be marked as protected, ensuring they are only accessible to authorized users.

Label and Description:

  • Each field in Custom Metadata has a label and description for clarity.

Additional Features of Custom Metadata

Declarative Setup:

  • Metadata records can be created and updated through the Salesforce UI or Metadata API.

Deployment:

  • Custom Metadata is part of Salesforce metadata and can be deployed between orgs using:
    • Change Sets
    • Metadata API
    • Packaging for Managed Apps

Access Methods:

  • Accessed using SOQL queries in Apex or through declarative tools.
  • Example in Apex
List<MyCustomMetadata__mdt> metadataList = [SELECT Field__c FROM MyCustomMetadata__mdt];

Field Relationships:

  • Custom Metadata supports relationships between fields, allowing advanced configurations and relationships with standard/custom objects or other metadata types.

Versioning and History:

  • As part of metadata, Custom Metadata changes are version-controlled and tracked

Key Differences in Fields Between Custom Settings and Custom Metadata

Field TypeCustom SettingsCustom Metadata
CheckboxSupportedSupported
CurrencySupportedNot Supported
DateSupportedSupported
DateTimeSupportedSupported
EmailSupportedSupported
NumberSupportedSupported
PercentSupportedSupported
PhoneSupportedSupported
TextSupportedSupported
Text Area (Long)SupportedSupported
URLSupportedSupported
PicklistNot SupportedSupported
Relationship FieldsNot SupportedSupported

Detailed Feature Comparison Table

FeatureCustom SettingsCustom Metadata
Field TypesCheckbox, Text, Number, Date, DateTime, Email, etc.Checkbox, Text, Number, Picklist, Relationships, etc.
Hierarchy SupportYes (Hierarchy Settings)No
SOQL UsageNo SOQL requiredRequires SOQL for querying
DeploymentRequires manual data migrationFully deployable through Metadata API or Change Sets
Field RelationshipsNot supportedSupported
Protected FieldsSupportedSupported
VersioningNot version-controlledVersion-controlled as part of metadata
CachingCached for performanceNot cached, relies on SOQL
PackagingLimited packaging optionsIdeal for managed packages

When to Choose Custom Settings vs Custom Metadata?

  • Use Custom Settings when:
    • Use Custom Settings when records don’t need to be deployed between orgs.
    • Choose Custom Settings for hierarchy-based configurations at the org, profile, or user levels.
    • Custom Settings are ideal for quick, SOQL-free access to cached data.
    • Use Custom Settings for simple data storage like feature toggles or default values.
  • Use Custom Metadata when:
    • Custom Metadata is best when records need to be deployed across orgs.
    • Use Custom Metadata for complex configurations involving relationships with objects or metadata.
    • Custom Metadata supports version control for better change tracking and manageability.
    • Choose Custom Metadata when you need SOQL access to dynamically fetch configuration data.
    • Use Custom Metadata for packaged apps where settings must be shipped as part of the app.

Conclusion

Both Custom Settings and Custom Metadata are powerful tools in Salesforce, each catering to different use cases. By understanding their fields and capabilities, you can choose the right tool for your Salesforce project. Custom Settings shine in lightweight, quick-access scenarios, while Custom Metadata excels in deployment and complex configurations.

Categories Apex Tags Custom Metadata in Salesforce, Custom Settings in Salesforce, Salesforce Configuration, Salesforce Development Guide, Salesforce Features Comparison
Custom Settings vs Custom Metadata vs Custom Labels: The Complete Salesforce Guide
The Ultimate Guide to Custom Settings in Salesforce
© 2025 • Built with GeneratePress