AnsweredAssumed Answered

Finding Parent Execution With RuntimeService

Question asked by gokceng1 on Dec 31, 2012
Latest reply on Jan 3, 2013 by jbarrez
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?

Outcomes