获取下一个工作流程实例

动词:getNextWorkflowInstance

可从以下位置获取: <Standard>

获取工作流程的下一个实例,以变量形式返回并在操作期间阻止其他执行访问当前工作流程。

1. 工作流程是一个过程流控制引擎。 工作流程表示 BPMN 文件内的一个流程。
2. 实例表示应处理的项。 变量负责接收工作流程执行的数据,将每个任务指定到各自对应的流程。

语法

getNextWorkflowInstance [--status(WorkflowInstanceStatuses)] --workflow(Workflow) [--startdate(DateTime)] [--enddate(DateTime)] --currenttask(String) [--batchkey(String)] [--businessstatus(String)] [--timeout(TimeSpan)] (WorkflowInstance)=instance (Boolean)=success

输入

脚本 设计器 必需的 AcceptedTypes Description
-- 状态 状态 可选 工作流程实例状态 有关要获取的下一个实例的系统状态。 选项:
  • 新建
  • 已暂挂
  • --workflow 工作流程 必需的 Workflow 将从中获取下一个实例的“工作流程”类型变量。
    此变量是使用装入工作流程命令的工作流程参数生成的。
    --startdate 开始日期 可选 日期时间 将从此获取下一个工作流程实例的开始时间。
    --enddate 结束日期 可选 日期时间 将从此获取下一个工作流程实例的结束时间。
    --currenttask 当前任务 仅当“状态”为“已暂挂”时 文本 属于在工作流程中定义的工作流程变量的当前任务的名称。
    --batchkey 批处理标识 可选 文本 创建批处理命令的参数中创建的唯一标识,用于将下一个实例分配给创造的实例组。
    当前租户内部不能存在两个相同的标识。
    --businessstatus 业务状态 可选 文本 用于根据业务规则逻辑识别实例的业务状态。
    此参数用于在流程内部进行指导,而不干扰脚本的操作。
    --timeout 超时 可选 时间范围数字文本 等待获取工作流程的下一个实例的最长时间。
    如果在类型为超时值的参数中未定义任何值,那么执行将使用设置超时值命令定义的上下文时间。 如果脚本未使用此命令,那么缺省时间为 5 秒。

    输出

    脚本 设计器 AcceptedTypes Description
    instance 实例 工作流程实例 返回已获取的下一个工作流程实例。
    将获取已完成的实例,以及有关该实例的变量值和常规信息。
    成功 成功 BOOLEAN 如果成功获取工作流程的下一个实例,那么返回“True”;否则,返回“False”。

    示例

    只要执行的实例不同,执行工作流程实例命令会阻止同时执行实例。

    defVar --name loadedWorkflow --type Workflow
    defVar --name mappedWorkflow --type Workflow
    defVar --name generatedNumber --type Numeric
    defVar --name initialNumber --type Numeric
    defVar --name createdBatch --type WorkflowBatch
    defVar --name createdInstance --type WorkflowInstance
    defVar --name instanceToExecute --type WorkflowInstance
    defVar --name executionSuccess --type Boolean
    defVar --name processId --type String --value "Id_f12b1ed6-0ecd-4bf7-b245-9bf31b63e900"
    // Download the following file to run the command.
    loadWorkflow --isfromfile  --file "bpmnTestVar.bpmn" --automapsubs  --automapvariables  loadedWorkflow=value
    mapWorkflowActivities --workflow ${loadedWorkflow} --mappings "Task_inc=firstTask" mappedWorkflow=value
    mapProcessVariables --workflow ${mappedWorkflow} --mappings "a=${generatedNumber}"
    createBatch --description "First Batch" --workflow ${mappedWorkflow} --key wf1231 createdBatch=value
    while --left "${initialNumber}" --operator "Less_Than" --right 4
    	generateRandomNumber --minimum 1 --maximum 4 generatedNumber=value
    	createWorkflowInstance --workflow ${mappedWorkflow} --defaultvalues "a=${generatedNumber}" --batch ${createdBatch} createdInstance=value
    	incrementVar --number ${initialNumber}
    endWhile
    beginBatch --batch ${createdBatch}
    // Get the first instance of the batch.
    	getNextWorkflowInstance --workflow ${mappedWorkflow} --status "New" --batchkey "${createdBatch.Key}" --businessstatus "${createdBatch.BusinessStatus}" --timeout 00:00:50 instanceToExecute=instance executionSuccess=success
    // As long as the batch has instances it will get the next one
    	while --left "${executionSuccess}" --operator "Is_True"
    		executeWorkflow --instance ${instanceToExecute}
    		getNextWorkflowInstance --workflow ${mappedWorkflow} --status "New" --batchkey "${createdBatch.Key}" --businessstatus "${createdBatch.BusinessStatus}" --timeout 00:00:50 instanceToExecute=instance executionSuccess=success
    	endWhile
    endBatch
    beginSub --name firstTask
    	logMessage --message executed --type "Info"
    endSub
    
    下载文件
    要运行样本脚本,需要下载该文件,并在装入工作流程命令的文件参数中显示其路径。

    另请参阅

  • 取消工作流程实例
  • 创建批处理
  • 创建工作流程实例
  • 结束批处理
  • 执行工作流程实例
  • 获取批处理
  • 列出批处理
  • 列出工作流程实例
  • 装入工作流程
  • 装入工作流程实例
  • 映射工作流程活动
  • 迁移工作流程版本
  • 重新启动工作流程实例
  • 启动批处理
  • 暂挂工作流程
  • 更新批处理
  • 更新工作流程实例