在Activiti中获取最新的正在运行的流程实例 [英] Get the latest running process instance in Activiti

查看:400
本文介绍了在Activiti中获取最新的正在运行的流程实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用
createProcessInstanceQuery获取Activiti中最新的运行进程?

Is it possible to get the latest running process in Activiti with createProcessInstanceQuery ?

runtimeService.createProcessInstanceQuery()。processDefinitionKey('myKey')。active ().singleResult()。getProcessInstanceId()
我想获取该定义的流程实例ID,但仅获取最新运行的流程。
谢谢

runtimeService.createProcessInstanceQuery().processDefinitionKey('myKey').active().singleResult().getProcessInstanceId() I want to get the process instance ID of that definition but only the latest running process. Thank you

推荐答案

要获取特定的正在运行的流程实例ID,可以将HistoryService与以下命令配合使用:$ b $例如,使用b获取具有特定定义键的最后启动的流程实例:

To get a specific running process instance ID , you can use the HistoryService with : for example to get the last started process instance with specific definition key:

historyService.createHistoricProcessInstanceQuery().unfinished().processDefinitionKey("YOURKEY").orderByProcessInstanceStartTime().desc().listPage(0,1)[0].id

这篇关于在Activiti中获取最新的正在运行的流程实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆