cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the parent processInstance id from call activity

yila_ya3116816
Champ in-the-making
Champ in-the-making
Hi,

I'm facing a problem to fetch the parent processInstance ID. I have a parent workflow calls a subprocess which is a call activitiy. This subprocess agains calls another call activity. Now I want to get the parent processInstance id while subprocess running. I tried getSuperExecution and subProcessInstanceId(subProcessInstanceId) but either returns null.

Below is what I tried inside service task:

String pid = execution.getProcessInstanceId();
String parentId =execution.getEngineServices().getRuntimeService().createProcessInstanceQuery().subProcessInstanceId(pid).singleResult().getProcessInstanceId();

AND:

ExecutionEntity executionEntity = (ExecutionEntity) execution.getEngineServices().getRuntimeService().createExecutionQuery().executionId(execution.getId()).singleResult();
String parentID = executionEntity.getSuperExecution().getProcessInstanceId();

Either returns null.

Anyone can help me with this?? Thanks a lot!!

Rachel
1 REPLY 1

trademak
Star Contributor
Star Contributor
Is the sub process already in a wait state when you want to do this, or is it still in the same transaction as when it was created by the call activity? Can you make a unit test of this that shows the error? That makes it easier for us to help.

Best regards,