Super Process Instance Id

how can I get the super process instance id using the java api? I can use the REST API and can get it. but want to see if Java API supports it.

My code has
List processInstances = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).list();

But this gives only the procesinstanceid, businesskey,caseinstanceid and tenant id

Thanks,

Hi adat,

even if the process instance is still running you can use the historyService to retrieve the super process instance id:

HistoricProcessInstance processInstance = 
  historyService.createHistoricProcessInstanceQuery().processDefinitionKey("someSubProcess").singleResult();
String superProcessInstanceId = historicProcessInstance.getSuperProcessInstanceId();

Cheers,
Tassilo

1 Like

@tasso94

Thanks for the reply.

I do not want to hardcode the process name. Is there a way to do it?

Hi @adat,

Maybe you can try subProcessInstanceId() and then getId().
Or it will cost too much as a query?

Best regards,
Yana