Newer Version Available
$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:
- Organization, the default value for everyone
- Profile, which overrides the Organization value
- User, which overrides both Organization and Profile values
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:
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.
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>