[go: up one dir, main page]

0% found this document useful (0 votes)
167 views6 pages

Custom Setting Vs Custom Metadata in Salesforce

Custom settings allow configuration data to be defined and accessed at the user, profile, or organization level, while custom metadata provides deployable configuration data that applies globally. Custom metadata supports versioning, dependencies, and flexible deployment between orgs.

Uploaded by

rajan251221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views6 pages

Custom Setting Vs Custom Metadata in Salesforce

Custom settings allow configuration data to be defined and accessed at the user, profile, or organization level, while custom metadata provides deployable configuration data that applies globally. Custom metadata supports versioning, dependencies, and flexible deployment between orgs.

Uploaded by

rajan251221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Custom Setting

Vs
Custom Metadata In
Salesforce

#kb_sfdc_content
Custom Settings Custom Metadata

Custom Setting is a type of object in Salesforce that


Custom Metadata is also a type of object in Salesforce
allows you to create custom data storage at the
that allows you to create custom data storage, but it is
Definition organization, profile, or user level. It is stored in the
customizable at the metadata level and can be
application cache and can be accessed through the
deployed between different environments.
Apex code.

Custom metadata types have a global scope. The


Custom settings have a hierarchical scope. You can
values stored in custom metadata are shared across
define custom settings at the organization level
the entire Salesforce org and cannot be scoped to
Scope (default), profile level, or specific user level. This allows
specific profiles or users. Custom metadata is generally
you to have different values for custom settings based
used for shared configuration data that applies to all
on different contexts.
users.

Custom metadata types are deployable using Change


Custom settings are deployable using change sets or
sets, Metadata API, or the Salesforce CLI. They can be
other deployment tools. You can package and deploy
Deployment included in a package.xml file or deployed using tools
custom settings along with other components to
like Salesforce DX. Custom metadata provides a more
different environments.
flexible and granular deployment mechanism.

Configuration Custom Settings can be configured using a user Custom Metadata can only be configured using the
Options interface in Salesforce setup. Metadata API or through the Salesforce CLI.

#kb_sfdc_content
Custom metadata types have built-in versioning support.
Custom settings do not have built-in versioning. If you You can create different versions of a custom metadata
Versioning need to maintain different versions of your custom type and track changes over time. This is particularly
settings, you would need to handle versioning manually. useful for managing configuration changes and
maintaining a history of metadata revisions.

Custom Metadata records can be accessed by all users,


Custom Settings have their own access controls and
Access Control but you can control the visibility of custom metadata
can be made visible to specific profiles and users.
types using permissions.
Custom Settings have some limitations on the number of Custom Metadata has a higher limit on the number of
Scalability
records and field types. records and can have a more complex structure.

Custom metadata types support dependencies between


Custom settings do not support dependencies between
components. You can define dependencies between
components. If you have dependencies between custom
Dependency custom metadata types and other metadata
settings and other metadata, you need to handle those
Management components, ensuring that related components are
dependencies manually during deployment or through
deployed together. This simplifies the management of
custom development.
complex metadata relationships.

Record Custom Settings do not support relationships between Custom Metadata supports relationships between
Relationships records. records within the same custom metadata type.
Custom Metadata records can be accessed
Custom Settings can be accessed synchronously in
Data Access synchronously in Apex code or asynchronously through
Apex code.
the Metadata API.

#kb_sfdc_content
Custom metadata types are visible and modifiable only by
Custom settings are visible and modifiable by
Visibility and administrators and developers through the Salesforce UI,
administrators and developers through the Salesforce UI
Modifiability API, or Metadata API. They are not directly accessible to
or API.
end users.
CRUD operations cannot be performed directly on
CRUD operations can be performed on custom setting
custom metadata types in Apex. Custom metadata
data in Apex. This means that you can create, retrieve,
DML in Apex records are treated as metadata, and they can only be
update, and delete records of custom settings
modified via the Metadata API, not through DML
programmatically.
operations.
Custom settings have a suffix of “__C” appended to their Custom metadata types have a suffix of “__mdt” added to
Suffix API names. This naming convention helps differentiate their API names. This naming convention distinguishes
them from standard objects. them from other types of metadata.
Custom Settings require a refresh or restart of the Custom Metadata changes are automatically reflected in
Refreshing Data
application to reflect changes. the application without requiring a refresh or restart.
Custom Metadata is suitable for storing metadata
Custom Settings are suitable for storing configuration
Usage Scenarios configurations and dynamic data that need to be
data and application settings.
deployed and managed separately from the code.
With custom metadata types, you can issue unlimited
Custom-setting data can be accessed using instance SOQL queries for each Apex transaction. However, it’s
methods, which allows you to avoid making SOQL important to note that custom metadata queries are
SOQL queries to the database. Custom-setting records are subject to the normal governor limits. Alternatively, you
cached in memory once they are accessed, providing can also use custom metadata relationships or custom
faster access to the data. metadata types’ description methods to access the data
without using SOQL queries.

#kb_sfdc_content
Apex Trigger
Custom Settings can have triggers associated with them. Custom Metadata does not support triggers.
Support
Search Custom Metadata supports SOQL queries for accessing
Custom Settings do not support SOQL or SOSL queries.
Functionality and filtering records.
Testing and Custom Metadata records require more complex mocking
Custom Settings can be easily mocked in unit tests.
Mocking in unit tests.

In contrast, the data stored in custom metadata types are


The data stored in custom settings are not visible or
visible and accessible in test classes without requiring the
Test Class accessible in test classes by default. Test classes cannot
use of the “SeeAllData” annotation. Test classes can
directly access or manipulate custom-setting data.
access and manipulate custom metadata data directly.

Custom Metadata supports change tracking, allowing you


Change Tracking Custom Settings do not support change tracking.
to track changes to metadata records over time.

Field-Level Security Custom Settings do not support field-level security. Custom Metadata does not support field-level security.

Integration Custom Settings are not directly available in the Metadata Custom Metadata is available in the Metadata API and
Considerations API and require custom handling. can be easily integrated with other metadata components.

Custom Settings cannot be used with Salesforce Connect Custom Metadata cannot be used with Salesforce
Salesforce Connect
(formerly known as Lightning Connect). Connect (formerly known as Lightning Connect).

#kb_sfdc_content
#kb_sfdc_content

You might also like