A WorkflowToken object represents a specific instance of a workflow in the running, waiting, waiting-signal, canceled, completed or failed state.

You obtain a WorkflowToken object by starting a workflow or by obtaining an existing workflow token by its ID, as the following method signatures show.

public WorkflowToken executeWorkflow(String workflowId, String username, String password, WorkflowTokenAttribute[] attributes);
public WorkflowToken getWorkflowTokenForId(String workflowTokenId, String username, String password);

The following table shows the properties of the WorkflowToken object.

Type

Value

Description

String

id

The identifier of this particular instance of a completed workflow.

String

title

The title of this particular instance of a completed workflow.

By default, the WorkflowToken title is the same as the Workflow title, although some operations do allow you to set a different WorkflowToken title when you start the workflow.

String

workflowId

The identifier of the workflow of which this WorkflowToken object is a running instance.

String

currentItemName

The name of the step in the workflow that is running at the moment when getWorkflowTokenForId is called.

String

currentItemState

The state of the current step in the workflow, with the following possible values:

running: the step is running

waiting: the step is waiting for runtime parameters, which can be provided by answerWorkflowInput

waiting-signal: the step is waiting for an external event from a plug-in

canceled: the step was canceled by a user or API-integrated program

completed: the step has finished

failed: the step encountered an error

You must run getWorkflowTokenForId every time you update this value.

Note

VMware recommends that you do not use currentItemState. The globalState property makes currentItemState redundant.

String

globalState

The state of the workflow as a whole, with the following possible values:

running: the workflow is running

waiting: the workflow is waiting for runtime parameters, which can be provided by answerWorkflowInput

waiting-signal: the workflow is waiting for an external event

canceled: the workflow was canceled by a user or by an application

completed: the workflow has finished

failed: the workflow encountered an error

The globalState is the state of the workflow as a whole.

You must run getWorkflowTokenForId every time you update this value.

String

startDate

The date and time that this workflow token started

The startDate value is set at the moment the workflow starts. When you obtain a token, its startDate has already been initialized.

String

endDate

Date and time that this workflow token ended, if the workflow token has finished.

The endDate value is filled in at the moment the workflow reaches the end of its run.

The endDate is only set when the workflow finishes in one of the completed, failed or canceled states.

String

xmlContent

Defines input parameters, output parameters, attributes, and the content of error messages. The values of the attributes and parameters are set in CDATA elements and error messages are set in <exception> tags, as the following example shows.

<token>
 <atts>
  <stack>
   <att n='attstr' t='string' e='n'>
   <![CDATA[attribute]]>Attribute value</att>
   <att n='instr' t='string' e='n'>
   <![CDATA[]]>Input parameter value</att>
   <att n='outstr' t='string' e='n'>
   <![CDATA[]]>Output parameter value</att>
  </stack>
 </atts>
 <exception encoded='n'>Error message</exception>
</token>