cancel
Showing results for 
Search instead for 
Did you mean: 

Subprocess Usage

lbds
Champ in-the-making
Champ in-the-making
Is there any way using the Rest-api to return the parent process id (and name) when you make a call to get the current processes?  Currently, when you look at the processes, it displays the subprocess (if that is where the workflow is in) but there seems to be no way to tell the parent.
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Subprocess has its execution id. Based on this Id you  can get execution:
http://www.activiti.org/userguide/#N13D6B
GET runtime/executions/{executionId}
response:

{
   "id":"5",
   "url":"http://localhost:8182/runtime/executions/5",
   "parentId":null,
   "parentUrl":null,
   "processInstanceId":"5",
   "processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
   "suspended":false,
   "activityId":null
}

in case of subprocess parentId  should point to the parent execution.

lbds
Champ in-the-making
Champ in-the-making
I tried that and unfortunately the ParentId was not populated.  If I look at the underlying tables, I have a record in there with proc_inst_id (and id_) with 163532 (parent) and 163564 (child).  On the child record, the super_process_instance_id is set to 163532 (parent) so it looks like it should return.  Am I not understanding what should be returned?   Based on your information, the parentId would be 163532 but this is my return:

{
    "id": "163564",
    "url": "http://server/activiti-rest/service/runtime/executions/163564",
    "parentId": null,
    "parentUrl": null,
    "processInstanceId": "163564",
    "processInstanceUrl": "http://server/activiti-rest/service/runtime/process-instances/163564",
    "suspended": false,
    "activityId": "childTask"
}

lbds
Champ in-the-making
Champ in-the-making
I just wanted to check if I'm doing something incorrect to not retrieve the parentID or if this is a bug?

martin_grofcik
Confirmed Champ
Confirmed Champ
I think you are not doing something wrong. Try to debug query and rest service. I tried to run some tests from the sources (e.g. for query org.activiti.engine.test.api.runtime.ExecutionQueryTest#testQueryByParentId) and it returns parentID. The issue could be in the way how rest service construct query.
Regards
Martin