Hello everyone, In this tutorial, you are going to learn Custom Settings in Salesforce. The Custom Settings in Salesforce are similar to the custom object that you can use to store some sort of static data at different level like Organization level, Profile level or at a User level.
Custom Settings in Salesforce:
Custom Settings is a way to store your configurable parameters in the safe confine of Salesforce database. You can think a Custom Setting similar to the custom object where you can store some sort of static data at the different level of organization. Similar to Custom Object we can add fields to custom settings and also we can add records. You can use a Custom Setting to store some constant value that can be used at different places like Workflow, Process Builder, Formulas, Approval Process, Validation Rules.
The main benefit of using Custom Setting over Objects is that:
- The Data in the Custom Setting s stored in the application cache hence efficient and fast access.
- No need to write SOQL to fetch data from the Custom Setting some methods available in the Custom Setting to get data.
There are two types of Custom Settings
- List Custom Setting
- Hierarchical Custom Setting.
1- List Custom Custom Setting:
A List Custom Setting is used to store some sort of static data at the organization level. The data in the List Custom Setting cannot varied at the User or Profile level but will be available for OWD only. This means for all Users.
Example Of LIst Custom Setting:
- To Store environment IDs and variables.
- Shipping and handling costs by weight class.
Example of retrieving the value from List Custom Setting in Apex:
where one is the Name
2- Hierarchical Custom Setting:
Hierarchical Custom Setting allows you to define value at the different level of organization Org Wide, Profile Level, or even at User Level.
Example of Hierarchical Custom Setting:
- To set the amount that might later change.
- To set the threshold for the approval process. For example, all users can approve deals up to $20,000 but the manager profile users can approve deals over $ 20,000/
- To Set the extended help message depending on a user’s preference.
Limits for Custom Settings:
- We can create 300 fields per custom setting.
- Custom setting object record 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.
- Salesforce SOQL Queries Example.
- Streaming API in Salesforce.
- Validation Rule in Salesforce
- Field Dependencies in Salesforce.
I Hope you would love this post. Please feel free to comment for any technical issues. Your feedback and suggestions would be appreciated,