Local variables
Local variables are set at the level of a process and are not shared with any other process or instance of that process. Local variables can be used anywhere where a variable is accepted by using its name, surrounded by curly brackets and preceded by a percent sign, for example: %{myLocalVariable}
.
When the process ends, the local variable forgets whatever value was given to it by the process and goes back to its default value. Local variables are generally used to keep information that is useful for the process itself but not to any other process or instance of the process. For example, you could store the current order ID for the process, a name, or an email. You can have as many local variables as you want in any given process.
Adding a local variable
To add a local variable:
- Select the process where you want to add the variable.
- Now you can use one of two methods:
- Click on the Home tab of the OL Connect Workflow Ribbon, then click Local Variable in the Variables group.
- Right-click on the process in the Configuration Components area, then click on Insert Local Variable.
Deleting a variable
- Right-click on the variable name in the Configuration Components pane and click Delete.
Note: Deleting a variable does not delete any reference to it. In both the case where a script refers to a variable and it is renamed, and the case of deleting a variable, any task or script that refers to it will cease to function and will generate an error.
Renaming a variable
- Right-click on the variable name in the Configuration Components pane.
- Click Rename.
- Type in the new name of the variable, then press Enter on your keyboard.
Note: While renaming a variable will correctly rename all references to it in task properties or wherever else it is used in a task, it will not change the references in any script within a Run Script task.
Setting a variable value within a process
You can set the value of a variable within your process in two ways:
- Use the Set Job Info and Variable action task. See Set Job Infos and Variables.
- You can use Scripts. See the chapter Using Scripts.
Tip: Variables may be used as variable properties in Task Properties (see Variable task properties).