Custom Workflow Variables

You can create custom workflow variables through Execute REST Call workflow steps to enable data retrieval from third-party servers in service or change requests. For more information on making REST calls through workflow steps, see Make REST Calls Through Workflow Steps.

Any custom variables you create are available only within the context of the originating request. Use the REST v3 API endpoints listed below.

For service requests:

  • GET /service-requests/{id}/variables/{name} — To create a custom variable within a request.
  • PUT /service-requests/{id}/variables/{name} — To update a custom variable within a request.
  • DELETE /service-requests/{id}/variables/{name} — To delete a custom variable within a request.

For change requests:

  • GET /change-requests/{id}/variables/{name} — To create a custom variable within a request.
  • PUT /change-requests/{id}/variables/{name} — To update a custom variable within a request.
  • DELETE /change-requests/{id}/variables/{name} — To delete a custom variable within a request.

For more information, see Commander API Reference.

Retrieve the values of workflow variables

Once you've created a custom workflow variable, you can retrieve its value in any workflow step for the request by using variable substitution. This means you can securely pass data from one workflow to another, without embedding sensitive information in workflow comments or having to make duplicate REST calls over the duration of a request.

For example, you may wish to fetch user data from a third-party server as part of an approval workflow, then pass that data to a completion workflow where Commander updates its own user records. Rather than expose a user's personal information in workflow comments or make separate REST calls in both the approval and completion workflows to retrieve the user record, you can instead create a custom variable that fetches the data for the approval workflow, and then securely retrieve that data for input in the subsequent completion workflow.

The variable syntax for retrieving the value of a custom variable is #{request.variable['*']}, where * represents the name of the custom variable.

The variable #{request.variable['*']} is provided in the Expression Picker. To insert a custom variable value directly in a workflow step, click within the desired field, select the variable, then click Insert Expression. Enter the name of your custom variable in place of *, then click OK.