Quantcast
Monday , December 10 2018

Custom settings

Custom Settings

They are similar to a custom object, it enables a user to create custom data, make an association between them similar to the custom object. The difference is that the custom settings are exposed in the application cache, this data can then be efficiently accessed without querying the database and reduce the overall overhead at the server and improves the efficiency of the App. The custom setting can be used with validation rule, apex class or formula fields etc.

 

There are two types of custom settings:

  1. List Custom setting
  2. Hierarchy Custom Setting

 

List Custom setting provides a reusable set of static data, we can put frequently access data in the custom setting and this can be accessed without SOQL query to the database. Data in list custom setting does not change with profile or user and is available throughout the organization.

 

Hierarchy custom setting is based on organization’s hierarchy profile logic and is not available throughout the organization. It checks the context of the user for its profile, organization and then returns the lowest value.

 

The custom setting can be created from UI of Salesforce and can be managed after creating the setting.

 

Custom Setting methods

These methods are all instance specific methods, they are called and operate by a particular instance of the custom setting. Custom methods are divided based on the type custom setting we are accessing.

 

List Custom Setting Methods

The following are instance methods are used to fetch values from list custom settings.

  1. getAll(): Map of the dataset is returned in this method
  2. getInstance(dataSetName): it returns the data of the specific dataset mentioned in the method.
  3. getValues(dataSetName): it returns the data specific to the dataset name mentioned in the method.

 

Hierarchy Custom setting methods

The following are instance methods are used to fetch values from Hierarchy custom settings.

  1. getInstance(): the return result is specific for a particular user.
  2. getInstance(userId):returns the result specific for a  specific user.
  3. getInstance(profileId):returns the result specific for a  specific profile.
  4. getOrgDefault(): Returns the result for the Org
  5. getValues(userId): Returns the result for the specific user.
  6. getValues(profileId): Returns the result for the specific user

 

Also, Have a look at the below resources:

  1. Best Salesforce Interview Questions book with Apex and Visualforce concept explained

Also, Have a look at the below learning resources:

  1. SOQL (Salesforce Object Query Language)

  2. Apex Trigger Best Practices and the Trigger Framework

  3. Salesforce Interview Question and Answers Part 2

  4. Salesforce Interview Questions on Test Class

  5. Salesforce-lightning-interview-questions-2018

     6. Salesforce Interview Questions Batch Class 

 

7.  Custom Setting in Salesforce

About Sumit Datta

Sumit Datta
I am a 3x Certified Salesforce developer with overall 5 years of IT experience and 3 years of Implementation experience in Salesforce. I am here to share my knowledge and help Beginners in Salesforce to understand the concepts of Apex, Visualforce, Salesforce Lightning and Salesforce Configuration.

Check Also

MODAL Box

How to create a Modal box in Lightning Component?

How to create a Modal box in Lightning Component? In this post we are going …

Salesforce Lightning Training

How to send parameters in AuraEnabled methods in Salesforce Lightning Components?

How to send parameters in AuraEnabled methods in Salesforce Lightning Components? Passing value to and …

Salesforce Lightning Tutorials

How to use lightning accordion

How to use lightning accordion and how to dynamically add accordion section in lightning. In …

Salesforce Lightning Tutorial

How to fetch and display list of records in Lightning Component

How to fetch and display list of records in Lightning Component? In this post we …

Leave a Reply

Your email address will not be published. Required fields are marked *