In this recipe, we have taken a closer look at the workflow token. The workflow token is the execution of a given workflow.
In this example, we start a workflow asynchronously and then wait for it to finish the workflow token:
Name |
Type |
Section |
Use |
|
Number |
IN |
It defines the time the workflow should sleep. |
|
WorkflowToken |
Attribute |
The workflow token of the asynchronous workflow. |
|
Number |
Attribute |
How long to wait between checks. |
06.07.01 Wait for Workflow Token
in the example package):
if (wfToken.state =="completed"){ return true; } else { return false; }
The workflow token is a unique ID that is created with each workflow run. It contains a link to all the content of a workflow run, such as the logs, as well as all the attributes and in-and out parameters. You can access it via JavaScript, the API (see the recipe Accessing Orchestrator REST API in Chapter 7, Interacting with Orchestrator) or the Control Center (see the recipe Control Center titbits in Chapter 2, Optimizing Orchestrator Configuration). When you look at a workflow run (the items underneath a workflow), you see nothing else but the Orchestrator Client accessing the data stored in the workflow token.
In addition to the properties, there are also some methods that allow you to cancel or answer the workflow.
Each workflow token has simple properties and methods, and they are as follows:
Properties and methods |
Description |
|
Converts the token ID into a string. |
|
This is the date and time the workflow was started. |
|
This is the date and time the workflow was finished. |
|
This is the state the workflow is in. The different states are |
|
This is the name of the workflow. |
|
This is the error message a workflow generated and is |
|
This helps get all the attributes of the workflow; it returns an Orchestrator properties object. The return is a JavaScript object. |
|
This helps get all the in-parameters of the workflow; it returns an Orchestrator properties object. The return is a JavaScript object. |
|
This helps get all the out-parameters of the workflow; it returns an Orchestrator properties object. The return is a JavaScript object |
|
Cancels the workflow execution. |
|
Saves the image of the workflow schema to a |
|
Gets the state of a given |