JBoss Community

Re: jbpm3 Assign task to multiple actors

created by Alejandro Velazquez in jBPM Development - View the full discussion

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>

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community