Get the latest running process instance in Activit

2019-09-15 07:30发布

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条回答
一夜七次
2楼-- · 2019-09-15 08:08

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
查看更多
登录 后发表回答