cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the parentId of call activiti task

cirerenat
Champ in-the-making
Champ in-the-making
I have a process (18725) with a call activiti (18502) and that process also has a call activiti (18920) task. When the process(18920) arrives a receive task, here's how it looks the execution table.


SELECT id_, proc_INST_ID_ , parent_id_, supER_EXEC_  FROM ACT_RU_EXECUTION
ID_  PROC_INST_ID_  PARENT_ID_ SUPER_EXEC_ 
18275   18275   null   null
18300   18275   18275   null
18502   18502   null   18300
18918   18502   18502   null
18920   18920   null   18918


I am using the runtimeService to signal the 18920, but before doing that, I want to know the parentId of the 18920. I am having difficulty to get that using the Execution Queries, since 18502 is not a parent of 18920. (And when I use activiti explorer to browse the active processes, I don't see 18918 and 18300., I guess I don't understand the super_exec_ relation).

<code>
Execution execution = runtimeService.createExecutionQuery().processInstanceId(18920).activityId(
                activityId).singleResult();
// Here, how can I find 18502 from "execution" ?
runtimeService.signal(execution.getId());
<code>
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
I'm not quite getting what you are trying to do. Why do you need that specific execution? What is the use case?

cirerenat
Champ in-the-making
Champ in-the-making
I gave that as an example, when I signal the child process, I also need to know the parent process.
Let me rephrase the question, for a given execution Id, how can I trace back the parent processes using Runtime Services ?
Thank you.

cirerenat
Champ in-the-making
Champ in-the-making
Anyone? If my example was confusing, ignore the specific data from that.
A flow [A] calls another actviti flow and @B, the execution is waiting on a receive task. If I know the execution Id of the , I want to find the execution Id of the [A].
(Use case is: Because, at the end of the [A], there's another receive task, I use it to get some results saved in execution variables, before I signal B to resume execution, I need to know the A's execution id to get the results at the end.)

frederikherema1
Star Contributor
Star Contributor
Are you using call-activity? You can use the processInstanceQuery.sub/superProcessInstance in that case. If not, you can use an executionListener and use/store the delegateExecution getParentId()…