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).

Hi Joram,

sorry for pulling out this old topic.
I try to set this property in a Spring Boot 2 application. I have not found how to do that…
I am using flowable 6.5.0 and have also not found this property in the flowable documentation (so far).
I tried:
flowable.process.enableEntityLinks=true

Can you give me an advice.

Thank you very much
Thomas

HI Joram,

Ok, I figured out myself:
I defined the following class:

@Configuration
public class FlowableEnableEntityLinkConfiguration implements EngineConfigurationConfigurer {

public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
processEngineConfiguration.setEnableEntityLinks( true );
}

@Bean
public FlowableEnableEntityLinkConfiguration getMyConfig() {
return this;
}
}

Is that ok, or are there other means to do this?

Thanks
Thomas

That’s the way indeed when there’s no property exposed in the Spring Boot configuration.

Hi Joram,

thanks for confirming!

Cheers
Thomas

Hello Joram,

Sorry for my (late) response, but I was around other projects and only now is the time that I’m returning to flowable.
I’ve tried your solution turning on the enableEntityLinks and the processInstanceIdWithChildren now returns the subprocess tasks.

Thanks so much!