1 Reply Latest reply on Feb 25, 2014 9:17 AM by buenavida

    getTasksByVariousFields - claim Task does not work

    buenavida

      Hello!

       

      In my process defintion my task is assigned to a user.

       

           <userTask id="UserTask_1" name="User Task 1">

            <incoming>tns:_1-_2</incoming>

            <outgoing>tns:SequenceFlow_1</outgoing>

            <potentialOwner>

              <resourceAssignmentExpression>

                <formalExpression>andi</formalExpression>

              </resourceAssignmentExpression>

            </potentialOwner>

          </userTask>

       

      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

      Andi

        • 1. Re: getTasksByVariousFields - claim Task does not work
          buenavida

          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.