Create Workflow Instance

Verb: createWorkflowInstance

Creates an instance on the specified Workflow.

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.


createWorkflowInstance --workflow(Workflow) [--businessstatus(String)] [--businessstatusreason(String)] [--defaultvalues(String)] [--batch(WorkflowBatch)] (WorkflowInstance)=value


Script Designer Required AcceptedTypes Description
--workflow Workflow Required Workflow Variable of type "Workflow" on which the instance will be created.
This variable is generated by the Workflow parameter of the Load Workflow command.
--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.
--defaultvalues Default values Optional Text Instance and value mappings that should be assigned.
--batch Batch Optional Workflow Batch Variable that holds a batch of instances, in which the current instance will be added to.
If the variable is added to a batch of instances, it can only be manipulated using the Start Batch and End Batch commands.


Script Designer AcceptedTypes Description
value Workflow instance Workflow Instance Returns the created Workflow instance.


The Map Workflow Activities command maps the activity of the BPMN file relating it to the subroutine "beginSubroutine" and returns the Workflow ID mapped later used in the Create Workflow command to create an instance within the current execution context in IBM RPA Studio.

defVar --name mappedWorkflow --type Workflow
defVar --name a --type Numeric --value 1
defVar --name workflow --type Workflow
defVar --name workflowInstance --type WorkflowInstance
// Download the following file to run the command.
loadWorkflow --isfromfile  --file "bpmnTestVar.bpmn" --process "Process 1" workflow=value
mapWorkflowActivities --workflow ${workflow} --mappings "Task_inc=beginSubroutine" mappedWorkflow=value
// Create an instance using the Mapped Workflow ID.
createWorkflowInstance --workflow ${mappedWorkflow} --businessstatus "In Progress" --businessstatusreason "Developing Script" workflowInstance=value
logMessage --message "${workflowInstance}\r\n" --type "Info"
beginSub --name beginSubroutine
   incrementVar --number ${a}
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
  • 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
  • Start Batch
  • Suspend Workflow
  • Update Batch
  • Update Workflow Instance