Use of Or/And combination conditions in the task query in Camunda 7

I need to implement this logic in the taskQuery to pull out a task list as :

pull up those tasks which meets one of these conditions :

– either assigned to this user
– or that task is unassigned but belongs to the group that user is part of (based on role )

With the above logic tried :


My list is always empty with the above query. However, if I try separately :

  • taskQuery.taskUnassigned().taskCandidateGroupIn(groups) ----> pulls out right tasks in the list
  • taskQry.taskAssignee(assignee) —> pulls out right tasks in the list


  • What am I doing wrong in my combined query when using the OR condition?
  • Is there a way to implement “AND” condition so that I can do something like :

Thanks in advance

Could you try the same without taskUnassigned() as taskCandidateGroupIn by default only selects tasks which are not already assigned to a user