Get the latest running process instance in Activiti

此生再无相见时 提交于 2019-12-25 16:55:07

问题


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

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


回答1:


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


来源:https://stackoverflow.com/questions/43684381/get-the-latest-running-process-instance-in-activiti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!