Set Variable

The Set Variable action gives the user the ability to define local or global variables inside the routines engine. Variables can be assigned the value of a variable, fixed value, or EL expression. In the following example, the "my_test" local variable is initialized with a value of 5.

The difference between local and global variables is visibility. A local variable can be accessed within the routine where it is defined (later in the chain of logic than where it is defined), but not from within another routine. Global variables, on the other hand, are accessible from any routine within the account. All local and global variables have the Text data type, so converting them to Integers or Numbers requires use of the "n:to_integer()" and "n:to_number()" EL functions.

To access a local or global variable in a routine, prefix the variable name with "_local" or "_global", respectively; so, the above variable would be accessed in an EL expression as "${_local.my_test}", or "${_global.my_test}" if it were a global variable.