创建批处理
动词:createBatch
可从以下位置获取: <Standard>
创建一组先前由命令 创建工作流程实例生成的实例来组织这些实例。
1. 工作流程是一个过程流控制引擎。 工作流程表示 BPMN 文件内的一个流程。
2. 实例表示应处理的项。 变量负责接收工作流程执行的数据,将每个任务指定到各自对应的流程。
语法
createBatch --description(String) [--businessstatus(String)] [--businessstatusreason(String)] [--instances(List<WorkflowInstance>)] [--defaultvalues(String)] --workflow(Workflow) --key(String) (WorkflowBatch)=value
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | Description |
|---|---|---|---|---|
| -- 描述 | Description | 必需的 | 文本 | 应用于创建实例组的描述。 |
| --businessstatus | 业务状态 | 可选 | 文本 | 用于根据业务规则逻辑识别实例的业务状态。此参数用于在流程内部进行指导,而不干扰脚本的操作。 |
| --businessstatusreason | 原因 | 可选 | 文本 | 调整业务状态的原因。 |
| --instances | 实例 | 可选 | 列表<Workflow Instance> | 从创建工作流程实例命令获取且应进行分组的工作流程实例。 |
| --defaultvalues | 缺省值 | 可选 | 文本 | 应指定的实例和值的映射。 |
| --workflow | 工作流程 | 必需的 | Workflow | 要在其中创建实例组的“工作流程”类型变量。此变量是使用装入工作流程命令的工作流程参数生成的。 |
| -- 键 | 密钥 | 必需的 | 文本、工作流程批处理 | 应用于创建当前实例组的唯一标识。当前租户内部不能存在两个相同的标识。 |
输出
| 脚本 | 设计器 | AcceptedTypes | Description |
|---|---|---|---|
| 值 | Batch | 工作流程批处理 | 返回已创建的实例组。 |
示例
使用该命令创建批处理以存储在同一脚本中创建的五个工作流程的实例。
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
下载文件
要运行样本脚本,需要下载该文件,并在装入工作流程命令的文件参数中显示其路径。