How to query read to complete task?

relate topic: How to find out if a task is active

I have bpmn: a → b->C->D->E
C,E is for role R1, D is for role R2.
a,b is completed, now i need to deal with C.

I’m not assign task to any specific user, but a group. so i add taskQuery.taskHadCandidateGroup("R1").

How to make taskQuery query only return the need to deal task(here is C), not all rest(here is C,E)?

I find the .active() is only for not suspend, not suitable for this purpse.

taskQuery.taskCandidateGroup("R1") returns running tasks for R1 group is set as candidate group.

If instances of both tasks C and E are returned then both are running tasks in which the candidate group is set to R1. If you want to return only instances of task C then you can be more specific and query by task definition key
taskQuery.taskDefinitionKey("<C_TASK_DEF_KEY>")

Is there any state property to distinguish the task C and E?

Which means C’s dependency b is complete, C is ready;
D’s dependency D is not complete, D is not ready.

In Camunda, the task doesn’t exist when it’s not yet ready.
If it exists, and it not completed, then it is ready.

1 Like