In the Spring ’16 release, Salesforce opened up access to several fields on some of the system objects with the use of Global Variables.
Global Variables are special variables that give you direct access to system objects that are in context. For instance, the $User Global Variable gives you access to the User who is currently running your Flow. (Here is a little about Global Variables in a prior post.)
Global Variables have a special nomenclature–they are always preceded with a dollar ($) sign:
Essentially a Global Variable is “merged” with a “merge field” to give you access to the value that is stored in that field. The exception is with the $Permission Global Variable, where the result you get is True, the permission is present for the current User, or False, the permission is absent.
How to Use Global Variables in Visual Flow
A few Global Variables are generally available everywhere in Visual Flow, but a few are available in one place only: Formulas
So if you don’t see the one you need, no worries, just create a formula which you can then use in the rest of your flow like you would a constant or variable:
A Few Examples of Ways to Use Global Variables
- Greet the user by their name:
- Determine if the user has a Custom Permission:
- With this Global Variable the return result will be either true (the Custom Permission exists for the user) or false (they do not have the permission)
- Determine what Profile the user is assigned to:
- Get the value of a Custom Label:
- (You can use a Custom Label to create a line feed in a text element.)
- The Name, State, Phone, Address, etc. of the org:
Bottom line is using Global Variables gives you instant access to a bunch of information without having to do a query, which is always a good thing.