Minimum task count in a group

I am running enterprise version camunda 7.10 and would like to know if there is a way to find out which user in a group has minimum task assigned to him/her?
I would like to fetch it out programatically as the user with minimum number of tasks assigned will be assigned the next task.

you have to try something like this in Java delegates:

List<Task> taskList= execution.getProcessEngineServices().getTaskService().createTaskQuery().taskCandidateGroup("candidateGroup").active().orderByTaskAssignee().list();
Map<String, Integer> map = new HashMap<>();
   taskList.stream().forEach(task->{
      int value  =  map.get(task.getAssignee())>0?map.get(task.getAssignee())+1:1;
      map.put(task.getAssignee(), value);
});

Map contains keyvalue pair of Assignee::Number of tasks, so you can find assignee with least number of tasks in a group.

2 Likes

Thanks @aravindhrs. I also figured out the same kind of logic in java delegate.