7 Replies Latest reply on Nov 23, 2010 4:01 AM by Michael Wohlfart

    Skipping a task node

    Paul Jacobsen Newbie

      There are certain situations I have where a task node should be skipped. I'm pretty sure you're not supposed to do this (i.e. cancel the task) from an event like when the node is entered or when the task is created... and I've already seen problems with the token being locked when I do... but does anyone have ideas for how you can make a programmatic decision to just pass right through a task node that doesn't need any tasks?

      Thanks Much!
      Paul

        • 1. Re: Skipping a task node
          Ronald van Kuijk Master

          put a decision in front of it and decide there.... way more visible (graphically)

          • 2. Re: Skipping a task node
            Paul Jacobsen Newbie

            It's not an option that our user community would accept (i.e. the option you suggest has been posed and shot down as the skip feature is already possible in our current workflow engine).

            Customer's workflows typically have hundreds of tasks any of which workflow managers can elect to "skip". Placing a decision node in front of every task would put a burden on the process designers to create decisions in front of them and would make the graphs tougher to decipher when we double the node counts by putting "skip" decisions in front of every task.

            • 3. Re: Skipping a task node
              Ronald van Kuijk Master

              Hundereds of tasks? Wow.... what kind of branch is that?

              First of all, it would be nice if in further posts you also describe what has been proposed and 'shot down'. Saves me an initial post and writing these kinds of second posts.

              What is a "workflow managers"? A kind of admin? Give him the jBPM console and he can 'cancel' all the tasks he wants and/or reassign to anyone.

              But before proposing anything else (what might have been shot down), you can always unlock the token if you are fairly sure you are the only one acting on it. Regarding the locking.


              • 4. Re: Skipping a task node
                Paul Jacobsen Newbie

                Sorry about that...I definitely see how explaining why normal paths like building it into the process definition aren't a possibility would help people that are kind enough to help me... and hopefully others who might be searching for answers later.

                To answer your questions...

                Hundereds of tasks? Wow.... what kind of branch is that?

                Highly regulated customers of ours like pharmas and medical device manufacturers with international scope frequently require many-many people review / approve things before they are ready for production (legal, regulatory, marketing, managers etc.).

                What is a "workflow managers"? A kind of admin?

                Correct. Project/workflow managers can be aware of certain tasks that may not need to be performed for one reason or another. In many cases this can be when "cycles" (i.e. rejection or back transitions) happen and tasks are re-executed for a process instance. The project manager may say these tasks won't be needed this iteration and skip/cancel them.

                Give him the jBPM console and he can 'cancel' all the tasks he wants and/or reassign to anyone.

                The problem is that I believe you can only cancel after task instance are created. In my case, a task may need to be marked as skipped/cancelled before the instance ever gets created... which is where I was getting into trouble trying to cancel/skip the task based on a variable when the workflow traverses through the canceled task node. Example: the manager sees that marketing has already provided sufficient review and will "cancel" their task so that they won't be presented with it when the workflow progresses to their piece.

                you can always unlock the token if you are fairly sure you are the only one acting on it.

                I thought about that... just wasn't sure if that was the way to do this (i.e. reacting to events in the workflow and canceling the tasks if they are flagged as such).

                Also... just an FYI... we are actually using the jBPM libraries and have our own front end.

                Thanks for much for all the help!


                • 5. Re: Skipping a task node
                  Ronald van Kuijk Master

                  Paul,

                  I'm in doubt on what to advise you. On the one hand what you describe to me sounds as essential for the process and should be modelled in. On the other hand, I understand your reluctance and to some extend agree.

                  Ok now a more concrete response...

                  What you could do is create a task-node with more than one task in it. Set the task-node attribute 'create-tasks' to false and have an actionhandler that on task-node enter event, just creates the task for the 'manager'. On that task, have an actionhandler that on the task-end event creates the other tasks based on a variable. It is kind of the other way around. Not cancelling them selectively, but creating them selectively. You could even automate this, if you e.g. have processvariables with certain values on which you can decide to create the tasks or not.

                  • 6. Re: Skipping a task node
                    LX T Newbie

                    Is the task-node still available or it was removed?

                     

                    I can not find it in version 4.3.

                    • 7. Re: Skipping a task node
                      Michael Wohlfart Expert

                      jBPM4 is a complete rewrite, the closest to the jBPM3's "task-node" is probably the "task" tag in jBPM4

                      http://docs.jboss.com/jbpm/v4/userguide/html_single/#task

                      to create multiple tasks in one node you might be better off by using a custom node

                      http://docs.jboss.com/jbpm/v4/userguide/html_single/#custom

                      override the execute() method and do what the TaskActivity is doing:

                       

                          DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
                          TaskImpl task = dbSession.createTask();
                          task.setTaskDefinition(taskDefinition);
                          task.setExecution(execution);
                          task.setProcessInstance(execution.getProcessInstance());
                          task.setSignalling(true);