Variables and Functions Overview
Variables and functions can be used in free-text fields within tasks and workflows. When a variable or function is specified in a free-text field, the Controller inserts its value into the field when the task or workflow is run.
Triggers can pass variables and functions into the tasks and workflows that they launch.
Additionally, email notifications for Controller resources (agents, OMS servers, and cluster nodes) can use Built-In Variables that are specific to that type of resource.
Types of Variables
Universal Controller supports the following types of variables, all of which can be used in free text fields within tasks:
These variables are created by the user for use within:
| |
These variables, maintained by the Controller, allow you to access information about task instances and other related data, such as task name, task status, and trigger name. | |
These variables calculate some value, such as current date and time, or perform some function, such as _replaceAll. |
How Variables and Functions Are Resolved
When the Controller processes a field value, it scans for ${...} references and resolves them in a fixed order:
- Variables:
${my_var} - Level-2 inner functions:
${___function(...)} - Level-1 inner functions:
${__function(...)} - Outer (top-level) functions:
${_function(...)}
Functions resolve innermost first, so by the time an outer function runs, its inner-function arguments have already been resolved.
For a given variable name, the Controller returns the first match found in this order: task instance scope (variables on the task instance and inherited from parent workflow(s), with the nearest level taking precedence), then built-in task instance variables, and finally global variables (subject to the execution user's Read permission). If a name matches nothing, the original ${name} text is left in place.
Variables can also reference other variables. The Controller re-scans repeatedly, so ${x} where x = ${y} resolves through to y's value. To guard against circular references, two limits apply: a maximum resolution depth and a maximum growth in the resolved text's length. If either limit is exceeded, the Controller logs a warning and leaves the original, unresolved value in place.
Setting Variables under Special Circumstances
The Controller also supports several features that allow you to set variables under special circumstances:
- Manually launch tasks and temporarily set user-defined variables.
- Manually launch all of the tasks associated with a trigger while supplying variable values used by the task(s) (see Triggering with Variables).
- Use the Set Variable action to set variables within a task or workflow.
- Use the ops-variable-set CLI function to set variables.