4 Replies Latest reply on May 27, 2011 9:57 AM by sasir

    jbpm3 Assign task to multiple actors

    sasir

      In jBPM3, I have a requirement where in i have to assign a task to multiple actors and all of them have to finish it. its not the same as assigning the users as pooled actors. in jbPM5, we can pass comma separated actors but in jbpm3 its not retreving the personal task list if we pass in that manner

       

      Can some one please advise how this can eb accomplished in jBPM3?

        • 1. Re: jbpm3 Assign task to multiple actors
          avelazquez

          I thnik, the simplest way is to define individual assigned tasks into the Task Node.

          The Task Node will leave after all task are attended.

           

          <task-node name="task-node1">

               <task name="TaskForActor1">

                    <assignment actor-id="actor1"></assignment>

               </task>

               <task name="TaskForActor2">

                    <assignment actor-id="actor2"></assignment>

               </task>

               <task name="TaskForActor3">

                    <assignment actor-id="actor3"></assignment>

               </task>

          </task-node>

          • 2. Re: jbpm3 Assign task to multiple actors
            sasir

            Thanks for replying. But i dont have control over how many users can be assigned for finishing the task and hence need to do this dynamically. Can you please tell me how we can do this programatically

            • 3. Re: jbpm3 Assign task to multiple actors
              avelazquez

              OK,

              Programatically,you can add an Action to the enter-event in the Task Node.

              In the ActionHandler you create the tasks required (individual assigned) via the TaskMgtInstance; something like:

               

              //First, obtain the unassigned task from the node

              TaskNode taskNode = (TaskNode) executionContext.getNode();

              Task myTask = taskNode.getTask("My Unassigned Task")

               

              //Then, create the required task instances, by using myTask as model.

              TaskMgmtInstance taskMgtInstance = executionContext.getTaskMgmtInstance();

              for(.....) {

                   TaskInstance ti = taskMgtInstance.createTaskInstance(myTask, executionContext().getToken());

                   ti.setName(......);

                   ti.setActorId(.....);

                   .....

              }

               

              In order to make this works, you have to disable the automatic creation of task instances in the Task Node. By setting the attribute: create-tasks="false". So, the task-node is something like:

               

              <task-node name="task-node1" create-tasks="false">

                   <event type="node-enter">

                        <action class="my,paq.CreateTaskActionHandler" name="CreateTaskActionHandler"></action>

                   </event>

                   <task name="My Unassigned Task">

                      ......

                   </task>

              </task-node>

              • 4. Re: jbpm3 Assign task to multiple actors
                sasir

                Works like a charm..Thanks Alejandro