Using Expressions with Variables |
Advanced users who have knowledge of the JavaScript language can use expressions to perform string, mathematical, or other advanced operations on variables.
The valid syntax to use is as follows:
<%Expression%>
The expression that is enclosed by <% and %> is evaluated by the JavaScript engine. There must be no space characters just after the starting <% or just before the ending %>.
Examples of valid syntax are as follows:
<%1+2%>
<%MyVar%> (where "MyVar" is a variable that is defined in Process Builder)
You can use expressions in instances where a variable reference is used to read a variable's value. The following procedures give examples of where you can implement them in Process Builder.
To define the value of a custom global variable
To specify the path of a document to print in a Print Document action
To set a variable's value in a Set Variable action
To write a message that contains a variable expression in a Write Message to Log action
To set an action's Action property to run the action conditionally
To specify which case action to run based on an expression evaluation result in a Select Case action
All defined variables can be used, whether they are defined as built-in or custom or they received their values in run time by the trigger event data. Do not use undefined variables.
Reserved names must not be used for variables. Because expressions are evaluated as JavaScript expressions, some names conflict with JavaScript language and must be avoided. These names include JavaScript reserved words, such as for and var, and the names of built-in JavaScript objects, such as Math and JSON.
All the built-in JavaScript objects can be used, such as Math, RegExp and JSON. However, not all objects are valid expression evaluation results.
All built-in JavaScript objects can be used in the expression, but not all of them are valid expression evaluation results. The following JavaScript types are accepted as valid:
String
Number
Boolean
Array (the elements in the Array must be valid evaluation result types)
Uint8Array
Date