Update Workflow Instance
Verb: updateWorkflowInstance
Updates information regarding an instance, being used within an execution routine specified previously in Map Workflow Activities.
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
updateWorkflowInstance [--businessstatus(String)] [--businessstatusreason(String)]
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--businessstatus | Business status | Optional | Text | Business Status used to identify instances according to the business rules logic.
This parameter is used for guidance within the flow, without interfering with the script's operation. |
--businessstatusreason | Reason | Optional | Text | New reason to justify the Business status to be updated. |
Example
The Update Workflow Instance command updates the instance, being used within the subroutine previously specified by the Map Workflow Activities command. The instance is run by the Execute Workflow Instance command.
defVar --name mappedWorkflow --type Workflow
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
defVar --name status --type String --value "In progress"
defVar --name reason --type String --value "Developing Script"
defVar --name newStatus --type String --value "New status"
defVar --name newReason --type String --value "New reason"
defVar --name successRunInstance --type Boolean
defVar --name a --type Numeric --value 1
// Download the following file to run the command.
loadWorkflow --isfromfile --file "bpmnTesteVar.bpmn" --process "Id_f12b1ed6-0ecd-4bf7-b245-9bf31b63e900" --automapvariables workflow=value
mapWorkflowActivities --workflow ${workflow} --mappings "Task_inc=inicioSub" mappedWorkflow=value
createWorkflowInstance --workflow ${workflow} --businessstatus "${status}" --businessstatusreason "${reason}" --defaultvalues "a=${a}" workflowInstance=value
executeWorkflow --instance ${workflowInstance} successRunInstance=Success
logMessage --message "${workflowInstance.BusinessStatus}\r\n${workflowInstance.BusinessStatusReason}" --type "Info"
beginSub --name inicioSub
updateWorkflowInstance --businessstatus "${newStatus}" --businessstatusreason "${newReason}"
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.