Query for either assignee or candidateGroup


I’m trying to query for tasks based on either assignee or candidateGroup. I have the following code:


The issue is that if assign a task directly to the user without adding a candidate group then the above query doesn’t work. It seems as though you need a candidateGroup in order for the above to work. Is it possible to say "assignee or candidate group (even if there is no candidate group assigned to task)?

Hi @aminmc,

This is a known issue with or queries that join tables and is documented in https://app.camunda.com/jira/browse/CAM-9114. As a workaround you can make two separate queries and merge the results manually.


Thanks @thorben. Is there someone a timeframe for this fix? Happy to raise a PR if no one is looking at it.

Hi @aminmc,

Feel free to raise a pull request at any time.
Keep in mind that the test coverage within this fix could be tricky.

Best regards,

We use one native SQL to return union results as workaround so that we only query once to DB.

Good point, @wangyugod

I am facing the same problem.
Is it not fixed yet?

From JIRA ticket I extracted that seems 7.12.0-Alpha version fixes this, but I am using Camunda-engine-7.17.0 and seems still persists. Can you please confirm?

There is another workaround for that to fix it in the same query to not create another one?
Thank you in advance.

Finally self-solved with a custom query in my code, I hope it can be solved for the future