Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

$Setup

A global merge field type to use when referencing a custom setting of type “hierarchy.���

Usage

Use $Setup to access hierarchical custom settings and their field values using dot notation. For example, $Setup.App_Prefs__c.Show_Help_Content__c.

Hierarchical custom settings allow values at any of three different levels:
  1. Organization, the default value for everyone
  2. Profile, which overrides the Organization value
  3. User, which overrides both Organization and Profile values
Salesforce automatically determines the correct value for this custom setting field based on the running user’s current context.

Custom settings of type “list” aren’t available on Visualforce pages using this global variable. You can access list custom settings in Apex.

Example

The following example illustrates how to conditionally display an extended help message for an input field, depending on the user’s preference:
1<apex:page>
2    <apex:inputField value="{!usr.Workstation_Height__c}"/>
3    <apex:outputPanel id="helpWorkstationHeight" 
4        rendered="{!$Setup.App_Prefs__c.Show_Help_Content__c}">
5        Enter the height for your workstation in inches, measured from the 
6        floor to top of the work surface.
7    </apex:outputPanel>
8    ...
9</apex:page>
If the organization level for the custom setting is set to true, users see the extended help message by default. If an individual prefers to not see the help messages, they can set their custom setting to false, to override the organization (or profile) value.