Load Workflow Instance
Verb: loadWorkflowInstance
Loads an instance from a Workflow, returning that instance into a variable, to be handled later.
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
loadWorkflowInstance --workflow(Workflow) [--fromorchestrator(Boolean)] --instanceid(String) (WorkflowInstance)=workflowinstance (Boolean)=success
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--workflow | Workflow | Required | Workflow | "Workflow" type variable from which the instance will be loaded.
This variable is generated through the Workflow parameter of the Load Workflow command. |
--fromorchestrator | Is From Orchestrator | Optional | Boolean | When enabled, it will load the instances associated with an Orchestration process.
During the creation of an Orchestrator in the IBM RPA Control Center, it is possible to attach a Workflow process to this Orchestration process; with that, the instances of both functionalities become the same. |
--instanceid | Instance ID | Only whenIs From Orchestrator is False | Text | Instance identifier, obtained from the Workflow instance parameter of the Create Workflow Instance command. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
workflowinstance | Workflow Instance | Workflow Instance | Returns the Workflow instance, according to the Instance ID and Workflow informed. |
success | Success | Boolean | Returns "True", if the instance was successful in loading, or "False", otherwise. |
Example
The Load Workflow Instance command loads an instance of the "mappedWorkflow" Workflow, returning the loaded instance and the success of the execution.
defVar --name mappedWorkflow --type Workflow
defVar --name a --type Numeric --value 0
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
defVar --name loadedInstance --type WorkflowInstance
defVar --name success --type Boolean
// 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 Process" --businessstatusreason "Developing Script" workflowInstance=value
loadWorkflowInstance --workflow ${workflow} --instanceid "${workflowInstance}" loadedInstance=workflowinstance success=success
logMessage --message "${loadedInstance}\r\n${success}" --type "Info"
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 enter its path in the File parameter of the Load Workflow command.