jerryfiunam (61) [Avatar] Offline
#1
Hi again Tijs smilie,

In my webapp I want to query for all the active process instances where a user is involved. I do this with this sentence:

List<ProcessInstance> previo = runtimeService
.createProcessInstanceQuery()
.involvedUser(userId)
.active()
.list();

But the problem I have right now is that this sentence retrieves ALL THE PROCESS INSTANCES no matter if the instance is a process or a subprocess. I wonder if there exists a way to query just for those processes that are SUPERPROCESSES, that is, a way to exclude the subprocesses from the query.

I have taken a look into, for instance, the TaskService where you can do something similar with Tasks using the sentence " excludeSubtasks()" that belongs to TaskQuery. I wonder is there exists something similar in the ProcessInstanceQuery. If not I would like to know some ideas in order to exclude the suprocesses. Also if not exists this, do you think I can request for this functionality in JIRA? Something like:

List<ProcessInstance> previo = runtimeService
.createProcessInstanceQuery()
.involvedUser(userId)
.active()
.excludeSubprocesses().
.list();

Thanks again for your time.

Regards,

Jerry
tijs.rademakers (494) [Avatar] Offline
#2
Re: Processes and Subprocesses
Hi Jerry,

I saw that you created a JIRA issue for this right?
Yes I think we can still add this for the 5.13 releases, certainly makes sense.

Best regards,

Tijs