AnsweredAssumed Answered

Strange results with HistoricTaskInstanceQuery

Question asked by matthias1 on Aug 20, 2012
Latest reply on Aug 23, 2012 by matthias1
Hey !

So here is what I'm trying to do:

I want to have a list of all tasks, which the current logged-in user has been assigned to in any unfinished process instance.
So my query looks like this:

HistoryService historyService = ProcessEngines.getDefaultProcessEngine().getHistoryService();
String userId = ExplorerApp.get().getLoggedInUser().getId();
List<HistoricTaskInstance> alreadyClaimedTasks =

The query is nested in the ClaimTaskClickListener, and it gets called before the task is assigned, so I can stop the assignment if I want to, because one of the already claimed tasks is connected to the current task. I need this to implement a Separaton of Duty between Tasks.

When I test this with a small process consisting of 4 user tasks it shows some strange behaviour. If I assign the first task, it gets added properly to the list. On assigning any additional task, the first task gets added again instead of the new task.
To view the content of the list I use tomcat console outputs.
I have been searching my code for an error quite some time now and haven't found a solution, so I hope you can help me out!

Best regards,