In my process defintion my task is assigned to a user.
<userTask id="UserTask_1" name="User Task 1">
I get the task by methode getTasksByVariousFields of TaskService - taskService.getTasksByVariousFields(null, null, processInstancIdList, null, null, null, null, false);
If I try to claim the task I get an exception of type PermissionDeniedException. Error message: User '[UserImpl:'andi']' was unable to execution operation 'Claim' on task id 1 due to a no 'current status' match.
The weird thing is, that if I get the task by methode getTasksAssignedAsPotentialOwner("andi", "en-UK") i can claim the task altough I get the same TaskSummary-Object. All attributes have the same values.
What is the reason for that?
Thanks for your help
The reason that it is only possible to claimi a task in a "READY" state. If the Actor is set, the state of the task is "RESERVED".
Because taskService.claim assigns a task to a user you don't need to claim a RESERVED task.
So determine the task state. If the state is "READY" claim it. If it is "RESERVED" you can't claim it.