How can we filter for tasks NOT assigned to a given user?

Hey Camunda users,

I’ve been trying to figure out an easy way to filter for tasks not assigned to a given user. something similar to:

TaskQueryDto queryDto = new TaskQueryDto();
queryDto.setActive(true); // I need active tasks
queryDto.setInvolvedUser(reqUserId); // For a given user
queryDto.setAssigneeExpression(“${!'” + reqUserId + “'}”); // But are not assigned to the user

I am hoping there is an easy way to negate the result via the assignee expression but I may be wrong.
Also, the TaskQuery has an or() / endOr() but it doesn’t provide a negation like a not() / endNot().

Is it possible to use such an assignee expression that’s negating the result set?
${! someUserName }?

Hi @paulbors,

you can only negate boolean variables.

The assignee should be a string.

But you could implement any list logic in a bean method that returns a string and filter a list based on any parameter that you pass. You can call your bean with an expression as well.

Hope this helps, Ingo

Hey @Ingo_Richtsmeier,

You lost me a bit. I was hoping I could get the filtering done at the DB level via the SQL not in my Java code. I would have to load all open tasks from the DB and manipulate them in memory.

Perhaps I’m not understanding your answer. Could you provide an example of such a bean? Maybe a link to one of Camunda’s repos on GitHub?

Check out TaskQuery#taskAssigneeNotIn. It returns tasks that have an assignee that does not match the provided value. It’s available in 7.13.0-alpha3 and higher.


When is 7.13 due to release?
Because that’s exactly what I need :slight_smile:

I might have to back-port that feature otherwise.

End of May is the release date.

Last Q I promise… how can we subscribe to email notification alerts for new releases?

We don’t have mail notifications for the open-source community currently, but you can follow our blog: It has an RSS feed: