Creating a Set Variable Action within a Task or Workflow

Overview

The Set Variable action allows you to set a variable to a specific value for a task or workflow, and to select a scope (level of usage) for that variable (see Variables and Variable Scope, below). Unless you set the scope of the variable to GLOBAL, which specifies that the variable can be accessed at any time by any task, workflow, or trigger, the value exists in memory only for the time that the task or workflow is running, or until another Set Variable action sets the variable to another value.
 

Note

Variables with a Variable Scope set to GLOBAL are added to the list of global variables on the Variables list (Automation Center > Other > Variables) after the task or workflow is run.

You can use the Set Variable action to create a new variable or modify an existing variable.

When creating a Set Variable action, you can trigger the Set Variable action based on one or more of the following:

  • Status
  • Exit codes
  • Late start
  • Late or early finish

Variables and Variable Scope

A variable defined for a task under the Variables tab for that task is used only by that task.

A variable defined for a workflow under the Variables tab for that workflow is available for any task in that workflow; a task will use the variable value defined for the workflow unless the variable is defined for that task.

A variable defined for a task or workflow in the Set Variable Action Details lets you specify, in the Variable Scope field, the scope of that variable. You can specify that a variable be available for:

  • Only the task where it is set.
  • All tasks within the task's parent (immediate) workflow.
  • All tasks within the task's top-level parent workflow.
  • All tasks and workflow instances.

For example, if you set a variable for a task to be available within the scope of its parent workflow, the value of that variable is propagated up to the parent workflow level. As each task in the workflow is run, that value is available for that task.

Creating a Set Variable Action

Step 1

Display the Task Details of the task for which you are creating the Set Variable action.

Step 2

Click the Actions tab. A list of any defined Actions for that task displays.
 

Step 3

Click the  button that displays on the Set Variables row. The Set Variable Details pop-up displays.
 

Step 4

Using the field descriptions below as a guide, complete the fields as needed.

Step 5

Click a  button to save the record in the Controller database.

Step 6

If appropriate, repeat these steps for any additional Set Variable actions you want to create.

Set Variable Details Field Descriptions

The table below describes the fields and buttons in the Set Variable Details.

Field Name

Description

Action Criteria

This section contains criteria for performing the action.

Type Details

Displays - on the Set Variables actions list - the Variable Scope, Name, and Value for this action.

Action Inheritance


For Workflow tasks only; the records that this action applies to.

Options:

  • Self
    The action applies only to the workflow; it is not inherited by its children tasks. For example, if the action is defined for the Defined status, when the workflow where the action is specified transitions into the Defined status, the action will run for the workflow. When children tasks within this workflow transition into the Defined status, the action will not run.
  • Self/Children
    The action applies to the workflow and any children under the workflow (it is as if each child under the workflow had the action specified on itself). For example, if the workflow or any of its children transition into the Defined status, the action will run.
  • Children
    This action applies only to the children under the workflow and not the workflow itself. For example, if any child of this workflow transitions into the Defined status, the action will run. However, when the workflow where this action is specified transitions into the Defined status, this action will not run.

Status

The status of the task, by itself or together with an exit code, that will trigger this Set Variable action. You can specify as many statuses as needed.

Exit Codes

Specifies one or more exit codes that will trigger the event. If you specify an exit code, you must also specify at least one status. Use commas to separate multiple exit codes; use a hyphen to specify a range. Example: 1, 5, 22-30.

On Late Start

Generates the action or notification if the task started late, based on the Late Start Time specified in the task.

On Late Finish

Generates the action or notification if the task finishes late, based on the Late Finish time specified in the task.

On Early Finish

Generates the action or notification if the task finishes early, based on the Early Finish Time specified in the task.

On Projected Late

Execute the Action when the task instance is projected to be late based on critical path projected end times. Only applicable when a Late Start Time, Late Start Duration, or Late Finish Time is specified for the task instance.

Note

This field displays in the Details only if the Controller is configured for critical path calculations with an enabled Critical Path Calculations Permitted Universal Controller system property.

Description

Description of this action.

Action Details

This section contains additional details about the action.

Variable Scope

Applies to variables associated with a task in a workflow.
 
Options:

Scope

Scope Value

Description

Self

1

The variable is updated or created in the scope of the task instance running the action. If the task instance is a workflow, then any child of that workflow will be able to read that variable.

Parent

2

The variable is updated or created in the immediate parent workflow scope, allowing a child within a workflow to make a variable available to any other child in the same workflow (at the same level).

Top Level Parent

3

The variable is updated or created at the top-level workflow variable scope, allowing a child anywhere in the workflow hierarchy to make a variable available to any other child in the workflow hierarchy, regardless of which level in the workflow the task instances are running.

Global

4

A global variable will be updated and or created. Allows for variables to be shared across independent workflows.

System Notification

If Variable Scope = Global; Status of the Set Variable action that will trigger a system notification.
 
Options:

  • None
  • Operation Failure (default)
  • Operation Success/Failure
  • Operation Success

Note

The Controller must be configured for system notifications in order for system notifications to be triggered.

Name

Name of the variable. Up to 128 alphanumerics. The name must begin with an alphabetic character and can consist of: alphas (a-z, A-Z), numerics 0-9, _ (underscore). White spaces are not permitted; names are not case-sensitive. Do not define variables with the prefix ops_. The ops_ prefix is reserved for built-in variables.

If the specified variable name contains an embedded variable or function, the above restrictions will not be validated until runtime.

Value

Value of the variable.
 

Note

While a global variable value can never exceed 25000 characters, a task instance variable value assigned dynamically at run time (for example, using a function to assign a variable value to Self, Parent, or Top Level Parent, using the Set Variable Action, can exceed the 25000 character limit. Keep in mind, however, that the Maximum Nested Variable Expansion Universal Controller system property prevents unlimited variable value expansion.

Metadata

This section contains Metadata information about this record.

UUID

Universally Unique Identifier of this record.

Updated By

Name of the user that last updated this record.

Updated

Date and time that this record was last updated.

Created By

Name of the user that created this record.

Created

Date and time that this record was created.

Buttons

This section identifies the buttons displayed above and below the Action Details that let you perform various actions.

Save

Saves a new Action record in the Controller database.

Save & New

Saves a new record in the Controller database and redisplays empty Details so that you can create another new record.

Save & View

Saves a new record in the Controller database and continues to display that record.

New

Displays empty (except for default values) Details for creating a new record.

Update

Saves updates to the record.

Delete

Deletes the current record.

Refresh

Refreshes any dynamic data displayed in the Details.

Close

Closes the Details pop-up of this action.