List Batches

Verb: listBatches

Available from: <Standard>

Lists a group of instances, previously created by the Create Workflow Instance 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.

Syntax

listBatches --workflow(Workflow) [--startdate(DateTime)] [--enddate(DateTime)] [--status(Nullable<BatchStatuses>)] [--businessstatus(String)] (List<WorkflowBatch>)=value

Inputs

Script Designer Required AcceptedTypes Description
--workflow Workflow Required Workflow "Workflow" type variable in which the instance group will be listed.
This variable is generated through the Workflow parameter of the Load Workflow command.
--startdate Start Date Optional Date Time Starting date from which instances of the group will be listed.
--enddate End Date Optional Date Time Ending date from which instances of the group will be listed.
--status Status Optional BatchStatuses Systemic status for the instance group to be listed. Options:
  • Cancelled
  • Done
  • Error
  • In Progress
  • New
  • Paused
  • --businessstatus Business Status Optional Text New status regarding the progress of the instance group.
    This parameter is used for guidance within the flow, without interfering with the script's operation.

    Outputs

    Script Designer AcceptedTypes Description
    value Batch List List<Workflow Batch> Returns the obtained instance group.
    Only the information count for the instance group is listed. For this parameter to be completely filled, it is necessary that the Get Batch command is used.

    Example

    The command displays the number of batches that have been successfully executed.

    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 executedBatch --type List --innertype WorkflowBatch
    // 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
    listWorkflowInstances --workflow ${workflow} --status "New" --batchkey loteInicial instancesQuantity=value
    beginBatch --batch ${instancesBatch} --timeout 00:00:40
    	foreach --collection "${instancesBatch}" --variable "${instanceToExecute}"
    		executeWorkflow --instance ${instanceToExecute} executedInstances=Success
    	endFor
    endBatch
    listBatches --workflow ${workflow} --status "Done" --comment "Displays the number of batches that were executed in the script" executedBatch=value
    logMessage --message "Instances Number: ${instancesQuantity.Count}\r\nExecuted Instances:  ${executedInstances}\r\nExecuted Batches Quantity: ${executedBatch.Count}" --type "Info"
    beginSub --name beginSubroutine
    	logMessage --message Executed --type "Info"
    	return
    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.

    See Also

  • Cancel Workflow Instance
  • Create Batch
  • Create Workflow Instance
  • End Batch
  • Execute Workflow Instance
  • Get Batch
  • Get the Next Workflow Instance
  • 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