Today's Offer - Salesforce Certification Training - Enroll at Flat 10% Off.

- Salesforce Blogs -

What is custom setting in Salesforce?

What is Custom setting?

Custom settings are similar to custom objects. We have to create our own custom setting similarly to creating 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 set of data and access it without querying it from apex. salesforce Curriculum Custom setting is two types

  1. List custom setting
  2. Hierarchycustom setting

List Custom Settings

Read: What Are The Validation Rules? How To Create Salesforce Validation Rules?

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 country.

Hierarchy Custom Settings

Hierarchy custom setting allows us to “personalize” settings for specific profiles or users. It can control user or profile in 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 record cannot be shared.
  • When a custom setting is created, owner is not So the owner can’t be changed.
  • Custom settings are a type of custom object. Custom setting also counts against the total number of custom objects available for the organization.

Navigation for Custom setting

Read: Difference Between Salesforce and Servicenow

Setup =>Build=>Develop=>Custom setting=>New What is custom setting in Salesforce What is custom setting in Salesforce Click on new to create fields What is custom setting in Salesforce After creating fields click on Manage What is custom setting in Salesforce Click on new What is custom setting in Salesforce What is custom setting in Salesforce Here 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 List<Country__c>getData {get;set;}
       public DemoCustomSetting ()

  Map<String,Country__c>alldata= Country__c.getAll();

       getData = alldata.values();


Visualforce page
<apex:page controller="DemoCustomSetting" sidebar="false" >
<apex:form >
<apex:pageblock title="Person Details">
<apex:pageblockTable value="{!getData }" var="A">
<apex:column value="{!A.Name}"/>
<apex:column value="{!A.State__c}"/>
<apex:column value="{!A.City__c}"/>
<apex:column value="{!A.Zip_code__c}"/>

Preview What is custom setting in Salesforce Hierarchy custom setting

Navigation for Hierarchy Custom setting

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

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

Read: What are the Ways to Import Data into Salesforce?

Here checkbox is true for Brandon, so validation rule is not applicable for Brandon. If account industry blank, then record will not save. What is custom setting in Salesforce Save then click on Manage What is custom setting in Salesforce Write validation rule on account object

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

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

Login  as brandon What is custom setting in Salesforce Record successfully saved What is custom setting in Salesforce Login as peter What is custom setting in Salesforce Got validation error What is custom setting in Salesforce

Salesforce Tutorial Overview

    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.

Trending Courses


  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

3 days 02 Feb 2020


  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

4 days 03 Feb 2020

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

4 days 03 Feb 2020


  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

5 days 04 Feb 2020


  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

11 days 10 Feb 2020


  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

4 days 03 Feb 2020

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

5 days 04 Feb 2020

SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

1 day 31 Jan 2020


Search Posts


Receive Latest Materials and Offers on Salesforce Course