Start Batch

Verb: beginBatch

Available from: <Standard>

Starts a group of instances, blocking other executions from accessing the initiated execution, until it is terminated by the End Batch command.

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.


beginBatch --batch(WorkflowBatch) [--variables(String)] [--timeout(TimeSpan)]


Script Designer Required AcceptedTypes Description
--batch Batch Required Workflow Batch Instance batch previously created by the Create Batch command.
--variables Variables Optional Text Mapping of variables and their values in the execution context.
1. These variables can be created, previously, on the IBM RPA Control Center. However, if the connection is to a local Database, the variables can be obtained from the database itself or created with the values assigned by IBM RPA Studio.
2. The value must be stored in a IBM RPA Studio variable.
--timeout Timeout Optional Time Span, Number, Text Maximum waiting time to run the instance group.
If no value is defined in the parameter of type timeout, the execution uses the context time defined by the Set Timeout command. If the script does not use this command, the default time is 5 seconds.


The Start Batch command starts the execution of a batch of instances. At the end, the message "Executed" is displayed for each instance of the batch and the number of instances that the batch has.

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
// 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
listWorkflowInstances --workflow ${workflow} --status "New" --batchkey loteInicial instancesQuantity=value
beginBatch --batch ${instancesBatch} --timeout 00:00:40
	// Starts the execution of the batch.
	foreach --collection "${instancesBatch}" --variable "${instanceToExecute}"
		executeWorkflow --instance ${instanceToExecute} executedInstances=Success
// Ends the execution of the batch.
logMessage --message "Instances Quantity: ${instancesQuantity.Count}\r\nInstance Executed: ${executedInstances}" --type "Info"
beginSub --name beginSubroutine
	logMessage --message Executed --type "Info"
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.

See Also

  • Cancel Workflow Instance
  • Create Batch
  • Create Workflow Instance
  • End Batch
  • Execute Workflow Instance
  • Get Batch
  • Get the Next Workflow Instance
  • List Batches
  • List Workflow Instances
  • Load Workflow
  • Load Workflow Instance
  • Map Workflow Activities
  • Migrate Workflow Version
  • Restart Workflow Instance
  • Suspend Workflow
  • Update Batch
  • Update Workflow Instance