Using Script Output as Input to a Workflow Step

When you capture the output of a script step as a comment, you can use the script's output or exit code as the input to a subsequent step in the workflow.

The following step types allow script output as input:

Set Custom Attribute step: Use script output to set a custom attribute value for a VM. The Set Custom Attribute step can be used in completion workflows and command workflows.

Any type of email step: Use script output to populate the Address List field.

The following variables are available:

#{steps[x].output}

#{steps[x].exitCode}

where x is a step number (beginning at 1) or a step name. For example, to use the output of the third step in a workflow, add this syntax to a subsequent step in the workflow:

#{steps[3].output}

Example: Using script output to set a value for a custom attribute

In the following completion workflow example, the first step is an Execute Script step that backs up a VM and records the time of the backup. Step 1 is configured to capture the script output as comment.

The second step is a Set Custom Attribute step that sets a value for the preconfigured custom attribute "Last Backup Time". We use the output from step 1 (the time of the last backup) as input for the custom attribute value.

example_attribute_step
Example: Using script output to populate an email address

In the following approval workflow example, the first step is an Execute Script step that queries Active Directory for the email address of the requester's manager. Step 1 is configured to capture the script output as comment.

The second step is a Send Approval Email step. We use the output from step 1 (the email address of the requester's manager) as input for the Address List field.

example_step_output_email

To see how this functionality fits into an end-to-end example, see Walk-Through: Creating a Workflow.