Getting Completed and active process Instance using Java API

Hi ,

Trying to get processInstance (completed/in process instances) details based on the BusinessKey. I have tried using below code but it only gets completed process, not the In-Progress instances.

   List<HistoricProcessInstance>  historyIns  =   historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).list();

Hi @sveeramani

Have you tried using the RuntimeService instead of the history service.


Hi Niall,

I could achieve the use case using following 2 API. Is there a single API method that can give both data.

// Get completed process instances from History.
List historyIns = historyService.createHistoricProcessInstanceQuery().tenantIdIn("")

   // Get active process instances
   List<ProcessInstance>  activeIns = runtimeService.createProcessInstanceQuery().tenantIdIn("").processInstanceBusinessKey(businessKey).list();