AnsweredAssumed Answered

get parent process instance  in a child process

Question asked by hyd198471 on Aug 19, 2013
Latest reply on Aug 21, 2013 by trademak
Hello everyone,
I have a question regarding to the call activity sub process. In principal, i would like to start a parent process, which has some user tasks and calling activities.
When child process in the calling activity starts, I would like to get the parent process instance. The input param is the task (Task), which is in the case the user task of child process.
ExecutionEntity executionEntity = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
String parentId =executionEntity.getParentId();
String superExecutionId = executionEntity.getSuperExecutionId();
ExecutionEntity rootExecution = (ExecutionEntity)runtimeService.createExecutionQuery().executionId(parentId).singleResult();
ProcessInstance processInstance=runtimeService.createProcessInstanceQuery().processDefinitionId(rootExecution.getProcessDefinitionId()).singleResult();
Somehow, I dont get the parent process instance. Can someone help to find out how to get the parent process instance?