3 Replies Latest reply on Jun 1, 2012 7:57 AM by swiderski.maciej

    update date of human task, after a user claim a task.

    milhaim

      Hi All,

       

      In my application a need to check when the user claimed a human task.

       

      I found the "createdon" : the date when the task was created.

       

      is there any way to know when the user claimed the task??

       

      Many thanks??

        • 1. Re: update date of human task, after a user claim a task.
          swiderski.maciej

          You could try to make use of events that can be registered on the task server, one of them is claim event that is fired immediately after claim operation so once received you can consider this time as when user took the task. Here is a bit of code that should do just that:

           

           

          EventKey key = new TaskEventKey(TaskClaimedEvent.class, taskId );       
          
          
          BlockingEventResponseHandler handler = new BlockingEventResponseHandler(); 
          client.registerForEvent( key, false, handler );
          
          // after event has been generated
          Payload payload = handler.getPayload();
          TaskUserEvent event = ( TaskUserEvent ) payload.get();
          

           

          This works exactly the same as completing user task where HT handlers register for TaskCompleteEvent. So you need to keep the handler alive to receive that events.

           

          HTH

          • 2. Re: update date of human task, after a user claim a task.
            milhaim

            Hi Maciej,

             

            So if I need to know for how long a task was claimed by the user I need to sore the time when this event was received as a variable in my processInstance ?

             

            thanks

            • 3. Re: update date of human task, after a user claim a task.
              swiderski.maciej

              Yes, I think that would be one valid approach.