6 Replies Latest reply on May 8, 2006 4:14 PM by saviola

    TaskInstance.end("XXXX") within Action

      I have some tasks defined in task-node as
      <task-node ...





      <task-node
      ...
      <state name='error'

      I access taskInstance from the action class which is created upon node entry and then in case of error I would like to jump to error state without executing rest of tasks in all other task-nodes. I call end("error") within the action class but it's not jumping to the error state. Instead after calling
      taskInstance.end("error")
      when I check executionContext.getProcessInstance().getRootToken().getNode() it shows same node that I am executing.

      Thanks in advance.

        • 1. Re: TaskInstance.end(
          kukeltje

          the 'error' you pass as a parameter should be the name of a transition, not a (state)node

          • 2. Re: TaskInstance.end(

            actually i have same name for the parameter as is state name, e.g.
            <task-node ...


            • 3. Re: TaskInstance.end(

              parenthesis didn' show up, what I mean is
              <task-node

              • 4. Re: TaskInstance.end(

                transition name='error' to='error'

                • 5. Re: TaskInstance.end(

                  Also, I noticed that you cannot generally call signal from action, instead you have to leaveNode. Is there any similar rule for task where you cannot change taskInstance from the action class.

                  • 6. Re: TaskInstance.end(
                    saviola

                    Hi, sbhatti!

                    Try setting

                    end-tasks
                    property of the task node to true and set the first transition to be the one you want to go when the task is finished. This way when you end a task with
                    taskInstance.end();
                    

                    all the other ununfinished tasks will be ended and the token will proceed to the default leaving transition which is the first one in the list.
                    You can use
                    taskInstance(transitionName);
                    

                    of course if you feel more comfortable.

                    Regards,
                    Saviola