Salesforce Custom Settings
What is Custom Setting?
Custom Settings are like custom objects. They are generally used to create custom sets of data and can be associated with an organization, profile or a specific user. The visibility of the custom setting can be controlled by marking it as public or protected. Custom Settings data set can be used in Formula fields, Validation rules, flows, Apex and SOAP API.
Types of Custom Settings
In Salesforce we have two type of custom settings
1) List Custom Settings
2) Hierarchy Custom Settings
List Custom Settings | Hierarchy Custom Settings |
It provides a reusable set of static data which can be accessed across your organization. | It uses a built-in hierarchical logic which lets you personalize settings for a specific user or a profile. |
The data in List Custom Settings is directly visible to any user in the org. | The data in Hierarchy Custom Settings checks the organization, profile and user settings for the current user and makes the data visible for them accordingly. |
The main advantage of using Custom Settings is that the data is cached, which enables efficient access without the cost of repeated queries to the database. One doesn’t have to use SOQL queries which count against the governor limits.
Limits on Custom Setting
- Here are a few limits that needs to be considered before using Custom Settings
- We can have up-to 300 fields per custom setting.
- Sharing a Custom Setting object or record is not possible.
- Since the Custom Settings are a type of custom object, each custom setting counts against the total number of custom objects available in your org.
- The total amount of cached data allowed for your org is the lesser of these two values:
- 10 MB
- 1 MB multiplied by the number of full featured user licenses in your org.
For example, if your org has three full licenses, you have 3 MB of custom setting storage. If your org has 20 org licenses, you have 10 MB of storage.