1 Reply Latest reply on Feb 25, 2009 6:17 AM by wurzelbutz

    Assignment Handler gets wrong ProcessInstance ID

    wurzelbutz

      Hello (:

      I'm using an Assignment Handler to assign my tasks to users and there is a strange issue:

      public void assign(Assignable arg0, ExecutionContext arg1) throws Exception {
      System.out.println("AH-PID:"+arg1.getProcessInstance().getId());
      System.out.println("AH-TN-ID:"+arg1.getTaskInstance().getTask().getTaskNode().getId());
      ... read target user from DB and assign ..
      }
      

      Here is what i do:
      1.) Start a new process with >1 TaskNodes(each containing at least 1 task). The processInstance has ID 16.
      Assignment Handler is called.
      AH-PID=16 --> OK
      AH-TN-ID=3424 --> OK

      2.) Start first tasknode
      3.) End first tasknode. TN is ended as expected.
      Assignment handler is called for the next TN.
      AH-TN-ID=3425 --> OK
      AH-PID=17 --> Why? I dont have a processInstance with ID 17. i did some debugging and noticed that the startDate of ProcessInstance 17 is the same as the current date.

      What is the correct way to read the current processInstance inside the Assignment Handler?

      br Hugo