Finding unassigned tasks with HistoricTaskInstanceQuery

How can I get all unassigned historic task Instances, in other words, all tasks where ‘assignee_’ in table ACT_HI_TASKINST is null?

I tried using org.flowable.task.api.history.HistoricTaskInstanceQuery. There is the method taskAssignee(Sting) there, I tried passing null to it, but it does not work.

There is a ‘taskUnassigned()’ method in org.flowable.task.api.TaskQuery, but I am not sure if I can use it together with HistoricTaskInstanceQuery. It would be nice if the latter also had such a method.

Hey @dliotev,

Seems like taskUnassigned() is not exposed in the HistoricTaskInstanceQuery, you are free to provide a PR and move that method to the TaskInfoQuery (which is shared between the runtime and historic query).

That said you can use the TaskQuery if you need to as well. The runtime tasks are a subset of the historic tasks and contains only tasks which have not been completed. I am fairly certain that you are interested in getting not finished unassigned tasks.

Cheers,
Filip

Thanks Filip, I guess I will try moving the method.