I'm trying out this very simple scenario:
- Process 1 has two tasks (task A -> task B)
- Process 2 has one "call activity" block (calling Process 1).
So, I started Process 2. And it goes directly to a state where we have 2 executions:
- The one that directly maps to the instance of Process 2. Let's say: 123
- The one associated with the "call activity". Let's say: 456
The question is: how to easily find the task where Process 1 is currently at? (it should be Task A).
Well, I can do it with this REST queries:
- First I query all the executions that belong to Process 2: runtime/executions?processInstanceId=123
Here I get: [{id: 123}, {id: 456, activityId: "calling_subproc"}]
Well, I know that 456 is an execution of sub process, so the next query is:
- runtime/process-instances?superProcessInstanceId=123&includeProcessVariables=true
Here I get: [{id: 789, activityId: "task 1"}]
But..., I can do that because I know it is a sub-process, I designed the model. But ... otherwise, how will a program (ignorant of that fact) find out about it? There's nothing in the response from query #1 indicates that 456 is a subprocess (meaning I'll have to execute query #2..., rather than runtime/tasks?executionId=456&includeProcessVariables=true, which by-the-way gives me {data: [0], total: 0, start: 0, sort: "id", order: "asc", size: 0})
---- ADDITIONAL COMMENT : -----
I think the REST service runtime/executions should support "superExecutionId" parameter (e.g.: runtime/executions?superExecutionId=87519)... such that given the execution id (in the calling process), we can directly navigate to the spawned sub-process (the database structure supports that already):
Thanks in advance, Raka