Get all the tasks (including from subprocesses) with ProcessInstanceId of the main process

Hi everybody,

Is there any way of getting all the active user tasks of a process and it’s subprocesses, providing only the main ProcessInstanceId?

I got this main process, that only has a call to a subprocess:
image
And the subprocess is:
image

I’ve started with sucess the main process:
String processInstanceId = processEngineMap.getProcessEngines().get(TENANT).getRuntimeService()
.startProcessInstanceByKeyAndTenantId(key, TENANT).getId();

The query says it is stop at the first task, of the subprocess. But I only now this when I query all the running tasks:

If I try to use the main Process InstanceId I’m not see any method that retrieves all the tasks of the parent and sons:
processEngineMap.getProcessEngines().get(TENANT).getTaskService().createTaskQuery().processInstanceId(processInstanceId).processInstanceIdWithChildren(processInstanceId).list()

or
processEngineMap.getProcessEngines().get(TENANT).getTaskService().createTaskQuery().processInstanceIdWithChildren(processInstanceId).list()

Wasn’t supposed processInstanceIdWithChildren to retrieve all tasks?

Or I have to go the big way around getting and iterating to know all the processes and their subprocesses, and then querying the tasks with all that IDs (with the getRuntimeService().createProcessInstanceQuery().superProcessInstanceId(processId).list()) ?

Thanks for your attention,
Filipe

Yes, but you will need to have entity links enabled (set enableEntityLinks to true on your process engine configuration).