cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Parent Execution With RuntimeService

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I've 2 layers: Parent Process and 3 child processes which are call activities. These 3 callactivities are parallel to each other.
As I started parent and query for parent I got 4 instead of 1.

1
runtimeService.createExecutionQuery().processDefinitionKey("level1Process").singleResult();

I checked 4 of them by debugging, and I see 3 of 4 are parallel executions, so their parentId values are null. They have same processInstanceId and processDefinitionId. After that inspection I started to use
createNativeExecutionQuery()
but I couldn't get what I want:

2
runtimeService.createNativeExecutionQuery().parameter("parentId", null).parameter("processDefinitionKey", "level1Process").singleResult();

This returns null. Also

3
runtimeService.createNativeExecutionQuery().parameter("processDefinitionKey", "level1Process").singleResult();

returns null. The last one should be the same as first query. Because I query processDefinitionKey in both but one of them gives exception the other null. What should I do?
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
I don't fully grasp what you are trying to do: but when you are using a call activity, it will call another process definition, hence the process definition key will be different. Did you try using the 'superProcessInstanceId' in your query?