2 Replies Latest reply on Jun 16, 2008 1:22 PM by fornachari

    Get Task Name in a ActionHandler

    fornachari

      Hi everybody,

      I have a simple process. In this process, I have one transition that have an action. This action invokes a Handler. So, I implemented a handler and in this handler I need to know what are the name of the last task.

      For example, my process:

      START
      |
      TASK1
      | ---------> in this transaction I invoke my handler
      END

      For the process above, I would like that my handler get the task name. The task name in this case is TASK1.

      I tried a lot of things but without success. Some code that I tried are below:

      public void execute(ExecutionContext context) throws Exception
      {
       try
       {
       String taskName = context.getTaskInstance().getName();
       }
      
       catch(Exception e)
       {
       }
      }
      


      AND

      public void execute(ExecutionContext context) throws Exception
      {
       try
       {
       TaskInstance taskInstance = context.getTaskInstance();
       String taskName = taskInstance.getName();
       }
      
       catch(Exception e)
       {
       }
      }
      


      Just to debug better, inside the catch method, I call a method to write the error in a TXT file. The error that I receive, to both cases above, is: NULL

      Anybody know How can I do it?

      Thank you.