Earn a Salesforce AI Certification by IIT + 12-Week Internship Secure Your Spot Today!

Earn a Salesforce AI Certification by IIT + 12-Week Internship Secure Your Spot Today!
What is Custom Settings in Salesforce?

What is Custom Settings in Salesforce?

The custom settings in Salesforce are similar to custom objects in Salesforce. They enable users to formulate distinct data sets or customized data blocks, enhancing data accessibility. Specific data pieces that need to be retrieved seamlessly from records can be efficiently managed using Custom Settings.

Custom settings are classified into two types: 

  1. Hierarchy Custom Settings
  2. List Custom Settings 

Custom Setting Type

Description

Examples

🏛️ Hierarchy Custom Settings

Hierarchical structure, varying values per level. Useful for inherited/overridden settings.

Record access settings, user-specific preferences, organisation-wide defaults. 

📜 List Custom Settings

List format, for managing multiple settings/options.

2-letter state codes, 3-letter currency codes (USD, INR), Catalogue numbers for products, etc.

Hierarchy custom settings enable you to personalize settings for specific profiles or users while maintaining a global default value, whereas List custom settings will allow you to create a list of values that are accessible throughout your organization.

Custom settings can be used to store a variety of data, such as configuration settings, feature switches, and business rules. They can be accessed using Apex code, Lightning components, and the Salesforce API. 

Custom settings can also be used to store data that can be referenced by formulas, validation rules, and workflow rules. Custom settings can help store data that needs to be accessed frequently and is not specific to a particular object or record. They can help you create more efficient and scalable applications and make it easier to maintain and update your organization’s data. 

Become a Salesforce Certified Professional

How Can an Organization Leverage the Custom Settings?

The performance of any web-based or Saas solution depends on how frequently you fetch data from the server. Each time you request the server to retrieve data and display it on the client side will impact the performance of the entire application. 

So what can we do for performance improvement? We cannot wholly avoid database calls, but we can definitely reduce the call by storing a certain set of data on the client side. Custom settings are used to store frequently accessed data in the application cache, which avoids repeated query execution to the database. Validation rules, flows, formula fields, Apex, and SOAP API can use this data for further processing. So custom settings are like custom objects on which we can create custom sets of data for any business use case.

Also Read on Lead Assignment Rules in Salesforce

How To Create a Custom Setting?

From the Setup, QuickFind box, search for “Custom Settings” and click on the “New” button.

What is Custom Settings in Salesforce?

In this example, we are creating currency codes against each country.

What is Custom Settings in Salesforce?

Once you create a custom setting, you will need to create custom fields. In this example, we need to create 2 text fields – country name and country code.

What is Custom Settings in Salesforce?

Done! Custom setting is created with custom fields. Yes, this is similar to custom objects and custom fields. Now, we can create some sample data as in the below diagram.

What is Custom Settings in Salesforce?

Types of Custom Settings

Custom settings are classified into two types: 

  1. Hierarchy Custom Settings
  2. List Custom Settings

Hierarchy Custom Settings

These custom settings are meant to use the logical hierarchy set up in the application, like profile level or user level. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the lowest value. (Org Level > Profile Level > User Level).

As an example, students have to submit the application form. Each student will submit the applications on different dates. Once they submit the application form, the data of submission should appear on their submitted application form. Here, the submission date can not be set up either at the organization level or the profile level. This should be handled at the user level. So we can create a hierarchy Custom Settings and store the values.

Read on Navigation Bar in Salesforce

List Custom Settings

If you want to use a set of reusable static data frequently across your organization, then it is wise to create a list custom setting and place that data over there. This data does not vary with profile or user, list custom settings data would be static and the same across the organization. ​​Popular examples of list custom settings are:

  1. 2 letter abbreviation of state code
  2. 3 letter abbreviation of currencies(USD, INR)
  3. Catalog numbers for products etc. 

Since you are not using SOQL queries to fetch the records, you do not have to worry about governor limit issues.

Note: From Spring’ 18 onwards, the creation of List Custom Settings has been restricted. By default, “Manage List Custom Settings Type” is disabled. To create a list setting, the admin has to enable this value.

What is Custom Settings in Salesforce?

Salient Features of Custom Settings

  1. Custom settings’ visibility can be either “Public” or “Protected.”
  2. The data can be accessed without SOQL. So query limit and governor limit issues won’t appear.
  3. Apex has access to both List and Hierarchy custom settings.
  4. Custom settings can be included in a package. However, only custom settings definitions will be included in the package, not the data. For example, if you export the package to a new org, only custom settings will be created in the new org. You will need to lead the data separately.
  5. In formula fields, custom settings can be used with the global variable Setup.

{!$Setup.CustomSettingName__c.CustomFieldName__c}

  1. You can also include a custom setting in a package. The Visibility setting determines whether the custom setting is visible in the package.
  2. Both list and hierarchy custom setting types are accessible to Apex.Get your Salesforce Certifications on the first go

Summing Up

If you are passionate about Salesforce and have decided to set foot on Salesforce, now is the right time. Check out our intensive Salesforce Platform Developer 1 training with capstone projects and take that first step towards your Salesforce career goal.

You can also get started with our self-learn Salesforce Developer course: Platform Developer 1 certification.

You can always join saasguru Slack Community to clear your doubts and interact with seasoned Salesforce professionals. 

Frequently Asked Questions (FAQs)

1. What are custom settings in Salesforce?

Custom settings in Salesforce are a type of data storage that allows administrators to create custom data sets and associate them with specific profiles or users. They are essentially custom objects that can store data in a key-value pair format. Custom settings are customizable and can be accessed and modified by Apex code, Visualforce pages, and formula fields.

2. What is the difference between custom settings and custom metadata types in Salesforce?

Custom metadata and custom settings in Salesforce have a distinct dissimilarity. Custom metadata records are deployable and can be packaged, allowing for easy migration between environments. On the other hand, custom setting data cannot be deployed, meaning it cannot be moved from one Salesforce instance to another.

Custom settings, however, provide a valuable feature by allowing the creation of custom data sets. They enable administrators to establish and associate custom data at the organizational level, profile level, or for specific users. This flexibility allows for the customization of data based on specific business requirements or user roles within the Salesforce org.

3. What is the use of custom settings in Salesforce?

Custom settings in Salesforce have various uses. Some common use cases include:

  1. Storing application configuration data such as default values or thresholds.
  2. Creating hierarchical custom settings to define different configurations for different profiles or users.
  3. Storing frequently accessed data to avoid making multiple database queries.
  4. Providing data that can be used in formula fields or Apex code.

4. What is the advantage of using custom settings in Salesforce?

The advantages of using custom settings in Salesforce include:
Custom settings are easily customizable by administrators without requiring code changes.
They can be accessed and modified at runtime, providing flexibility in managing application settings.
They can be accessed by all users or specific profiles, allowing for targeted configuration management.

5. What are the types of custom settings in Salesforce?

There are two types of custom settings in Salesforce:
Hierarchy Custom Settings: These settings have a hierarchical structure and allow different values to be defined for different profiles or users. They can be used to implement personalized configurations based on user roles or specific business requirements.
List Custom Settings: These settings allow multiple records to be defined and accessed as a list. List custom settings are useful for storing data that needs to be accessed as a collection, such as picklist values or lookup relationships.

6. Where are custom settings in Salesforce?

To populate data in the fields of a custom setting, follow these steps:

  • Access the Salesforce Setup menu.
  • In the Quick Find box, type “Custom Settings” and select “Custom Settings” from the search results.
  • Next to the desired custom setting, click on “Manage” to access the management page.
  • Alternatively, you can navigate to the detail page of the custom setting and click on “Manage” from there.
  • On the management page, you can specify or modify the name for the dataset associated with the custom setting.

7. When to use custom settings in Salesforce?

Custom settings are useful in various scenarios, including:
Storing application configuration data that may change frequently.
Providing different configurations based on user roles or profiles.
Avoiding repeated database queries by caching frequently accessed data.
Enabling administrators to modify settings without requiring code changes.
Sharing common data across multiple users or profiles.

8. How many custom settings can be created in Salesforce?

In Salesforce, you can create multiple custom settings. The number of custom settings you can create depends on the edition and limits of your Salesforce org. The specific limit can be found in the Salesforce documentation or by contacting Salesforce support.

9. What are the benefits of using custom settings in Salesforce?

Custom settings offer several benefits, including:

  • Reduction in SOQL queries: Custom settings allow you to reduce the number of SOQL queries your applications make, as data stored in custom settings can be fetched without using SOQL.
  • Application efficiency: They increase application efficiency by reducing server requests, as the frequently used data is stored and accessed from the application cache.
  • User or Profile specific customization: Using hierarchy custom settings, you can customize data access on a per-user or per-profile basis.
  • Data accessibility: Data stored in custom settings can be accessed across the entire application, including Apex code, Visualforce pages, formulas, validation rules, and more.

10. How to troubleshoot custom settings issues in Salesforce?

Troubleshooting custom settings in Salesforce usually involves:

  • Ensuring that the custom settings data is correctly populated and accessible.
  • Verifying that the custom setting is accessible for the user or profile that is encountering the issue.
  • Ensuring that the code or formula that is using the custom setting is correctly referencing it.
  • Checking the Salesforce governor limits as they apply to custom settings.
  • Ensuring that the custom setting is public if it needs to be accessed outside the package it was created in.

11. What are the limitations of custom settings in Salesforce?

Some limitations of custom settings are:

  • Data migration: Data in custom settings is not automatically included in packages or migration tools. You will have to export and import the data separately.
  • List custom settings creation: From Spring ’18 onwards, creation of list custom settings has been restricted.
  • Governor limits: While custom settings help avoid some governor limits by reducing SOQL queries, they do count against the total amount of cached data storage allowed in an org.

12. What are the best practices for managing custom settings in Salesforce?

  • Minimize usage: Use custom settings only when necessary, such as for storing data that needs to be accessed application-wide or when reducing SOQL queries.
  • Avoid sensitive data: Do not store sensitive data in custom settings, as they may be visible to users with the “View All Data” permission.
  • Regular review and update: Periodically review and update custom settings data to keep it relevant.
  • Use hierarchy custom settings: For user or profile-specific data, consider using hierarchy custom settings over list custom settings.

13. Where can I find more information about custom settings in Salesforce?

For more information about custom settings in Salesforce, you can refer to Salesforce’s official documentation, blogs, and learning resources. The Salesforce Developer Documentation and Salesforce Trailhead are particularly useful sources of information. You can also connect with the Salesforce community through forums, blogs, webinars, and Salesforce events for more insights and practical use cases.

Table of Contents

Subscribe & Get Closer to Your Salesforce Dream Career!

Get tips from accomplished Salesforce professionals delivered directly to your inbox.

Looking for Career Upgrade?

Book a free counselling session with our Course Advisor.

By providing your contact details, you agree to our Terms of use & Privacy Policy

Unlock Your AI -Powered Assistant

Gain Exclusive Access to Your Salesforce Copilot

Related Articles

Mass Assign User Permission Set in Salesforce

Learn how to efficiently mass assign user permission sets in Salesforce using tools like Data Loader. Save time and ensure accuracy. Read now!

How to Clone a FlexCard in Salesforce

Learn how to clone a FlexCard in Salesforce with this step-by-step guide. Simplify customization and boost efficiency effortlessly!

Salesforce Introduces Agentforce 2.0: Redefining How Work Gets Done

Salesforce introduces Agentforce 2.0, the AI platform transforming digital labor with autonomous agents and seamless workflows. Read now!