Custom Setting

Custom Settings

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. 
Data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. Because the data is cached, access is low-cost and efficient: you don't have to use SOQL queries that count against your governor limits.
This data can then be used by formula fields, validation rules, flows, Apex, and the SOAP API.
There are two types of custom settings:
1. List Custom Settings
Data in list settings does not vary with profile or user but is available organization-wide. 
Examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. 
2. Hierarchy Custom Settings
Uses a built-in hierarchical logic that lets you "personalize" settings for specific profiles or users. 
The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or "lowest," value. 
In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings.


  • Custom settings do not support relationship fields
  • Custom Metadata types can have relationships

        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
You can add up to 300 fields per custom setting

The following examples illustrate how you can use custom settings:
In the data retention project, we are retrieving data from aws. To Connect to aws we used key and secrete which is stored in a custom setting. These values are static and can be retrieved easily.
A shipping application requires users to fill in the country codes for international deliveries. By creating a list setting of all country codes, users have quick access to this data without needing to query the database.
An application displays a map of account locations, the best route to take, and traffic conditions. This information is useful for sales reps, but account executives only want to see account locations. By creating a hierarchy setting with custom checkbox fields for route and traffic, you can enable this data for just the "Sales Rep" profile.

No comments:

Powered by Blogger.