Get all active tasks of a process instance (via direct correlation)

Hello,
I am looking for an easy way, to get all active tasks from a process instance. My BPMN processes has a lot of nested sub processes. I have a main process, which calls activities, which call other activities and so forth.

I could try to get all active task with the REST API “/engine-rest/task” and “bubble up” by searching the parents, but this seems very inefficient. I would like to go top down, but this seems to be a lot of search calls, too. Isn’t there are direct connection between an active instances and all it active tasks?
Is there a are query getAllTaskByRootProcessId?

Best

Clemens

You should use a business key which would propagate down through all Call Activities and then when you query for tasks. You can add processInstanceBusinessKey as a parameter which would make sure you get all related tasks without needing to worry about the process they belong to.
You can read more about how to use business keys on T-Dogs blog post here.

Hello Niall,
thank you for the quick reply. I’ll give it a try with the business key.

Thanks!

Hello Niall,

I tried the businesskey, but it seems not to work. The business key is set:

http://localhost:8080/engine-rest/process-instance
Result:
{
“links”: [],
“id”: “3e183d99-5d34-11ea-90a1-0242ac110002”,
“definitionId”: “Process_Genomics:1:22250e7f-58b5-11ea-ad8f-0242ac110002”,
“businessKey”: "2 ",
“caseInstanceId”: null,
“ended”: false,
“suspended”: false,
“tenantId”: null
},

Then, I tried to discover the task:

http://localhost:8080/engine-rest/task
Request Body:
{
“processInstanceBusinessKeyLike”: "2 "
}

Result:
[]

I have no clue, why this doesn’t work.

Best
Clemens

Is your process waiting at a user task?
Also have you passed the business key to each call activity? You need to explicitly tick the box on the call activity which propagates the parent key to the child process.

Hi Niall,
thanks for the hint. It is working now. I had a white space in the business key. This seems to be a problem, even though I put the white space in the query string. I guess white spaces are not allowed (it wasn’t intended to use white spaces anyway)?

Best
Clemens