Get Batch
Verb: getBatch
Available from: <Standard>
Gets a group of instances, previously generated by the Create Batch command.
1. Workflow is a process flow control engine. A Workflow represents a process within a BPMN file.
Syntax
getBatch --workflow(Workflow) --key(String) (WorkflowBatch)=Batch (Boolean)=anypending (Boolean)=success
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --workflow | Workflow | Required | Workflow | Variable of type "Workflow" from which the group of instances will be obtained.
This variable is generated through the Workflow parameter of the Load Workflow command. |
| --key | Key | Required | Text, Workflow Batch | Unique identifier for the group of current instances to be obtained.
There cannot be two identical identifiers within the current tenant. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| Batch | Batch | Workflow Batch | Returns the instance group obtained from the Workflow command that belongs to the specified Key.
The filled instance group is obtained, in addition to the variable values and general information about it. |
| anypending | Pending | Boolean | Returns "True", if the instances were identified and stored in a group, or "False", otherwise. |
| success | Success | Boolean | Returns "True", if the command was successful, or "False", otherwise. |
Example
The Get Batch command gets the instance group previously created by the Create Batch command.
defVar --name mappedWorkflow --type Workflow
defVar --name a --type Numeric --value 0
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
defVar --name instancesBatch --type WorkflowBatch
defVar --name instanceToExecute --type WorkflowInstance
defVar --name executedInstances --type Boolean
defVar --name instancesQuantity --type List --innertype WorkflowInstance
defVar --name obtainedBatch --type WorkflowBatch
defVar --name hasInstance --type Boolean
defVar --name getSuccess --type Boolean
// Download the following file to run the command.
loadWorkflow --isfromfile --file "bpmnTestVar.bpmn" --process "Id_f12b1ed6-0ecd-4bf7-b245-9bf31b63e900" --automapvariables workflow=value
mapWorkflowActivities --workflow ${workflow} --mappings "Task_inc=beginSubroutine" mappedWorkflow=value
createBatch --description "Batch containing Workflow instances" --workflow ${workflow} --key initialBatch --comment "Creates a batch to store Workflow instances" instancesBatch=value
while --left "${a}" --operator "Less_Than" --right 5
incrementVar --number ${a}
createWorkflowInstance --workflow ${workflow} --businessstatus "In Progress" --businessstatusreason "Developing Script" --defaultvalues "a=${a}" --batch ${instancesBatch} workflowInstance=value
endWhile
beginBatch --batch ${instancesBatch} --timeout 00:00:40
foreach --collection "${instancesBatch}" --variable "${instanceToExecute}"
executeWorkflow --instance ${instanceToExecute} executedInstances=Success
endFor
endBatch
// Get the group of instances created earlier.
getBatch --workflow ${instancesBatch.Workflow} --key initialBatch obtainedBatch=Batch hasInstance=anypending getSuccess=success
logMessage --message "\r\nBatch Name: ${obtainedBatch}\r\nHas Instances: ${hasInstance}\r\nManaged to Get the Batch: ${getSuccess}" --type "Info"
beginSub --name beginSubroutine
logMessage --message Executed --type "Info"
return
endSub
Download File