How to query user tasks claimed or claimable for a group?

Let’s sey I’m a sales manager, and I’d like to re-assign tasks.
How can I query all tasks that must be completed by the sales group?
If I use taskCandidateUser(…) or taskCandidateGroup(…) I only see the not assigned tasks.

You’d need to collect all the assignee ids of the users managed by that person and do something like


1 Like


I have the same need, but no evolution since 2017 in the TaskQuery API: no way to select all user tasks claimed, without providing explicitely the list of all assignees.

Why don’t you provide a method allowing to search for all claimed tasks, when a search for all unclaimed tasks is present?

Thanks for your help

The task is claimed when it is assigned to the user. After that you can search for the tasks this are assigned = claimed by given user by:

/** Only select tasks which are assigned to the given user. */
T taskAssignee(String assignee);

 * Only select tasks which were last assigned to an assignee like the given value. The syntax that should be used is the same as in SQL, eg. %test%.
T taskAssigneeLike(String assigneeLike);

 * Only select tasks which were last assigned to an assignee like the given value. The syntax that should be used is the same as in SQL, eg. %test%.
 * This method, unlike the {@link #taskAssigneeLike(String)} method will not take in account the upper/lower case: both the input parameter as the column value are lowercased when the query is
 * executed.
T taskAssigneeLikeIgnoreCase(String assigneeLikeIgnoreCase);

 * Only select tasks with an assignee that is in the given list
 * @throws FlowableIllegalArgumentException
 * When passed name list is empty or <code>null</code> or contains <code>null String</code>.
T taskAssigneeIds(Collection<String> assigneeListIds);

If you need some specific query, you can use native queries or create a pull request with the extended functionality.


Thanks Martin :slight_smile:
What I’m looking for is the equivalent of the existing method TaskQuery::taskUnassigned()
but for assigned tasks, something like `TaskQuery::taskAssigned().
Without having to give the full list of possible users (which may be loooooonnnng… :))
Thanks again

Hey @wberges,

What you are requesting is entirely a new request which is entirely different that what was asked in the original post.

If you’ve had the need for TaskQuery::taskAssigned() and it is not there, then maybe you can do a contribution for it via a PR, and then it will be there :wink:?


Sure, but before doing a PR in GitHub, I wanted to be sure that I didn’t miss anything already available.
And I don’t understand why my request is completely different from this original post: it could be all claimed tasks or all claimed tasks by a group.



I see 3 possibilities

  1. task service query: taskService.createTaskQuery().taskAssigneeLike("%").list()

  2. native query: taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(org.flowable.task.api.Task.class) + " WHERE ASSIGNEE_ IS NOT NULL").list()

  3. pull request - in fact it should be easy - could you describe your use case little bit more?

Hi Martin,
My Use-Case:

  • A pool of users claimed a lot of tasks, some of them open since a while (lost after browser closed, switch on other tasks…).
  • I want to be able to get the list of all claimed tasks (without specifying explicitely the users) to:
    ** possibly unclaim tasks claimed since several days
    ** possibly reassign claimed tasks according to a context (priority, variable, date, user availability…)
    ** possibly cancel claimed tasks too old
    ** generate reports

Most of your requirements are related to the time when the task was claimed. There is a column in the task table CLAIM_TIME_ which holds this information. I did not see any queries for this column, so the only way to use it is to create a pull request or native query.