RSS

Global Variables in Visual Flow

31 May
Global Variables in Visual Flow

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:

  • $Api
  • $Label
  • $Organization
  • $Permission
  • $Profile
  • $Setup
  • $System
  • $User
  • $UserRole

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:

formula for global variable


A Few Examples of Ways to Use Global Variables

  • Greet the user by their name:
    • $User.FirstName
  • Determine if the user has a Custom Permission:
    • $Permission.custom_permission_name
    • 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:
    • $Profile.Name
  • Get the value of a Custom Label:
    • $Label.the_name_of_a_label_you_have_created
    • (You can use a Custom Label to create a line feed in a text element.)
  • The Name, State, Phone, Address, etc. of the org:
    • $Organization.Name

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.

Cheers!

Advertisements
 
Leave a comment

Posted by on May 31, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: