Cancel Workflow Instance
Verb: cancelWorkflow
Cancels the execution of the current Workflow instance.
1. Workflow is a process flow control engine. A Workflow represents a process within a BPMN file.
2. Instance represents the item that should be processed. It is the variable responsible for receiving data for the Workflow execution, assigning each task to its respective process.
Syntax
cancelWorkflow --instance(WorkflowInstance)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--instance | Instance | Required | Workflow Instance | Workflow instance to be canceled.
1. To obtain the instance to be canceled, the following commands can be used: 2. When canceling an instance, it can only be retrieved using the Restart Workflow Instance command. |
Example
The Cancel Workflow Instance command cancels the Workflow instance previously created by the Create Workflow Instance command.
defVar --name mappedWorkflow --type Workflow
defVar --name a --type Numeric --value 0
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
// Download the following file to run the command.
loadWorkflow --isfromfile --file "bpmnTestVar.bpmn" --process "Id_f12b1ed6-0ecd-4bf7-b245-9bf31b63e900" workflow=value
mapWorkflowActivities --workflow ${workflow} --mappings "Task_inc=beginSubroutine" mappedWorkflow=value
goSub --label beginSubroutine
// Create an instance using the Mapped Workflow ID.
createWorkflowInstance --workflow ${workflow} --businessstatus "In Progress" --businessstatusreason "Developing Script" workflowInstance=value
cancelWorkflow --instance ${workflowInstance}
beginSub --name beginSubroutine
while --left "${a}" --operator "Less_Than" --right 5
incrementVar --number ${a}
endWhile
endSub
Download File
To run the sample script, it is necessary to download the file and inform its path in the File parameter of the Load Workflow command.
Remarks
This command should be inserted into the script only if it is outside the context of the Execute Workflow Instance command.