- Salesforce Blogs -

What is the Custom Setting in Salesforce?

  • Jan 28, 2025
  • 437.7k
  • 4 min read
  • Comment
What is the Custom Setting in Salesforce?

Introduction

Custom settings are similar to custom objects. We have to create our own custom setting similar to creating a custom object.).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. The custom setting data can then be used by formula fields, validation rules, flows, Apex, and the SOAP API.

Why do We Need Custom Settings?

Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits to ensure that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds the limit then exception cannot be handled. When we need data we query from object and display, if we query multiple time there is chance of hitting governing limit. So to avoid governing limit we use custom setting. It allows us to store a set of data and access it without querying it from the apex. 

Salesforce Training For Administrators & Developers

  • No cost for a Demo Class
  • Industry Expert as your Trainer
  • Available as per your schedule
  • Customer Support Available
demo class

Custom Setting is Two Types

Custom Setting is Two Types

Read: Top 12 Salesforce APP Builder Interview Questions and Answers 2018
  1. List custom setting
  2. Hierarchycustom setting

List Custom Settings

A type of custom setting that provides a reusable set of static data that can be accessed across your organization. If you use a using a set of data frequently within your application, then we need to write SOQL to fetch that record from object which might increase the chance to hit governing limit .So put that data in a list custom setting and without writing SOQL we can access it. Data in list settings does not vary with profile or user but is available organization-wide. Examples of list data include city, state, Zip code for the country.

Hierarchy Custom Settings

A hierarchy custom setting allows us to “personalize” settings for specific profiles or users. It can control user or profile in the organization. The hierarchy logic checks the organization, profile, and user settings for the current. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings.

Limits in Custom Settings:

  • 300 fields per custom setting.
  • Custom setting object records cannot be shared.
  • When a custom setting is created, the owner is not So the owner can’t be changed.
  • Custom settings are a type of custom object. The custom setting also counts against the total number of custom objects available for the organization.

Navigation for Custom setting

Setup =>Build=>Develop=>Custom setting=>NewWhat is custom setting in SalesforceWhat is custom setting in SalesforceClick on new to create fieldsWhat is custom setting in SalesforceAfter creating fields click on ManageWhat is custom setting in SalesforceClick on newWhat is custom setting in SalesforceWhat is custom setting in SalesforceHere without querying from the record we can fetch the data from server and display in viusalforce page using custom setting.   How to get the Value from custom setting


public class DemoCustomSetting
{
    public ListgetData {get;set;}
       public DemoCustomSetting ()

    {
  Mapalldata= Country__c.getAll();

       getData = alldata.values();

    }  

   }
Visualforce page












PreviewWhat is custom setting in SalesforceHierarchy custom setting

Read: Salesforce Object Search Language (SOSL)

Navigation for Hierarchy Custom setting

Setup =>Build=>Develop=>Custom setting=>New Hierarchy custom setting allows controlling user and profile on organization level.

Create a checkbox field in the hierarchy custom. Here we have taken two users Brandon jack and Peter parker. When the checkbox is true it will bypass the validation rule for that particular user.

Here checkbox is true for Brandon, so validation rule is not applicable for Brandon. If the account industry blank, then the record will not save.What is custom setting in SalesforceSave then click on ManageWhat is custom setting in SalesforceWrite validation rule on the account object

!$Setup.HierachySetting__c.Checked__c && ISPICKVAL(Industry,'')
     

HierachySetting__c. is custom object Api name and Checked__c is checkbox field Api name.

Read: Salesforce Admin Salary Trends in 2025 | How much do Salesforce Admins Earn

Learn Salesforce in the Easiest Way

  • Learn from the videos
  • Learn anytime anywhere
  • Pocket-friendly mode of learning
  • Complimentary eBook available
Buy Self-learning at Discounted Price

Login  as brandonWhat is custom setting in SalesforceRecord successfully savedWhat is custom setting in SalesforceLogin as peterWhat is custom setting in SalesforceGot validation errorWhat is custom setting in Salesforce

Summary

We have tried creating a custom setting onin this blog. Remember, if you include custom settings in your distributed package, then you are required to create some builds that populate the settings with data after the package is installed. It is really easy to implement custom settings in your Salesforce CRM. So if you are planning to take certification on Salesforce then enroll with Janbask Traning. Happy learning!

Read: What Is Salesforce Chatter And Its Benefits?
JanBask Training

Written by

JanBask Training

The JanBask Training Team includes certified professionals and expert writers dedicated to helping learners navigate their career journeys in QA, Cybersecurity, Salesforce, and more. Each article is carefully researched and reviewed to ensure quality and relevance.

View all blogs

Leave a comment

Keep reading

Related Salesforce Blogs

Explore more Salesforce blogs

More Salesforce articles to go deeper on this topic — tutorials, comparisons, and career guides from the same category.

Explore Career Programs Built for the AI Era

Choose from live, mentor-led programs designed around today’s fastest-growing technology skills and tomorrow’s AI-powered job roles.

Explore More

Salesforce Career Programs

Live, mentor-led Salesforce programs designed around the same skills this blog covers.

Explore Salesforce courses

Explore more topics

Browse Blog Categories

Jump to another subject — AI, Cloud, Salesforce, Data, Testing, and more — and keep learning by topic.

Interviews

Browse Categories