Activity › Forums › Salesforce® Discussions › What Are Global Variables Explain With Examples?
-
What Are Global Variables Explain With Examples?
Posted by Aman on September 20, 2018 at 3:09 PMWhat Are Global Variables Explain With Examples?
Parul replied 7 years, 9 months ago 3 Members · 4 Replies -
4 Replies
-
Hi,
Global variables are the variables used to reference the general information about the current user or your organization on a page.
Example:
Global variables must be referenced using Visualforce expression syntax to be evaluated, for example, {!$User.Name}.
List of available global variables are as below:
1. $Action
2. $Api
3. $Component
4. $ComponentLabel
5. $CurrentPage
6. $Label
7. $Label.Site
8. $ObjectType
9. $Organization
10. $Page
11. $Profile
12. $Resource
13. $SControl
14. $Setup
15. $Site
16. $User
17. $UserRole
18. $System.OriginDateTime
19. $ User.UITheme and $User.UIThemeDisplayedThanks
- [adinserter block='9']
-
Adding some points:
Global variable is a type of merge field that yields information about the organization or the current user of the platform. Each global variable is easily identified because it distinctly starts with a dollar sign “$”.
Global variables are used in conjunction with other merge fields to reference important data about the organization. Customized links, formulas, buttons, and Visualforce pages allow the use of various global variables.
Thanks
-
Hi,
On vf page For example –
{!Api.Session_ID} – It gives the salesforceUI session id.
Hope this helps
-
Refer this ex:
<apex:page controller=”RecentlyViewedController”>
<apex:pageBlock><apex:pageBlockTable data=”{!RecentlyViewed}” var=”rv”>
<apex:column headerValue=”{!$ObjectType.RecentlyViewed.fields.Name.Label}”>
<apex:outputLink value=”{!URLFOR($Action[rv.Type].View,rv.Id)}”>
<apex:outputText value=”{!rv.Name}” />
</apex:outputLink>
</apex:column>
</apex:pageBlockTable></apex:pageBlock>
</apex:page>
Log In to reply.