Create Batch
Verb: createBatch
Available from: <Standard>
Creates a group of instances, previously generated by the command Create Workflow Instance, to organize them.
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
createBatch --description(String) [--businessstatus(String)] [--businessstatusreason(String)] [--instances(List<WorkflowInstance>)] [--defaultvalues(String)] --workflow(Workflow) --key(String) (WorkflowBatch)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--description | Description | Required | Text | Description that should be created for the instance group. |
--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 | Reason to justify Business status. |
--instances | Instances | Optional | List<Workflow Instance> | Workflow instances that should be grouped, obtained from the Create Workflow Instance command. |
--defaultvalues | Default Values | Optional | Text | Mapping of the instance and the values that should be assigned. |
--workflow | Workflow | Required | Workflow | "Workflow" type variable in which the instance group will be created.
This variable is generated through the Workflow parameter of the Load Workflow command. |
--key | Key | Required | Text, Workflow Batch | Unique identifier that should be created for the current instance group.
There cannot be two identical identifiers within the current tenant. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Batch | Workflow Batch | Returns the created instance group. |
Example
The command creates a batch to store five instances of Workflow created in the same script.
defVar --name mappedWorkflow --type Workflow
defVar --name a --type Numeric --value 0
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
defVar --name instanceBatch --type WorkflowBatch
defVar --name instancesBatch --type List --innertype WorkflowInstance
defVar --name quantity --type Numeric
// 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 ${mappedWorkflow} --key initialBatch --comment "Creates a batch to store Workflow instances" instanceBatch=value
goSub --label beginSubroutine
listWorkflowInstances --workflow ${mappedWorkflow} --status "New" --batchkey initialBatch --timeout 00:00:30 instancesBatch=value
count --collection "${instancesBatch}" quantity=value
logMessage --message "\r\nBatch Name: ${instanceBatch}\r\nBatch Instances Quantity: ${quantity}" --type "Info"
beginSub --name beginSubroutine
while --left "${a}" --operator "Less_Than" --right 5
incrementVar --number ${a}
createWorkflowInstance --workflow ${mappedWorkflow} --businessstatus "In Progress" --businessstatusreason "Developing Script" --defaultvalues "a=a" --batch ${instanceBatch} workflowInstance=value
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.