3 Replies Latest reply on Feb 16, 2006 3:39 PM by boerse scholz

    Task Assignment results in two tasks with same id

    Michael Holtzman Newbie

      Hi. I have a simple AssignmentHandler that simply calls assignable.setActorId("xxxx"). However, when I query for tasks by calling getTaskMgmtSession().findTaskInstances(Actor) it lists two tasks with the same id number.

      Also, when I end the task by calling taskInstance.end() it ends the task but does not advance the token to the next node. Explicitly signaling the process instance after the task has ended does advance the workflow to the next node.

      Any thoughts? Thanx.

        • 1. Re: Task Assignment results in two tasks with same id
          Koen Aers Master

          Can you show us the processdefinition and the code of the assignmenthandler that you have written?


          • 2. Re: Task Assignment results in two tasks with same id
            Michael Holtzman Newbie

            Process Definition:

            <?xml version="1.0" encoding="UTF-8"?>
             xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
             <start-state name="Start">
             <transition name="toGatherSummaryData" to="GatherSummaryData"></transition>
             <end-state name="End"></end-state>
             <node name="GatherSummaryData">
             <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
             <transition name="GetApproval" to="WaitForManagerApproval"></transition>
             <transition name="Failed1" to="ScriptFailed1"></transition>
             <event type="node-enter">
             <action name="TranNumToArgt" class="com.olf.workflowmgr.action.VariableToArgtActionHandler">
             <event type="node-leave">
             <action name="SaveSummaryData" class="com.olf.workflowmgr.action.ReturntToVariableActionHandler">
             <task-node name="WaitForManagerApproval">
             <task name="ManagerApproval" blocking="true">
             <assignment class="com.olf.workflowmgr.action.TaskAssignmentHandler">
             <transition name="CheckCredit" to="QuickCreditCheck"></transition>
             <transition name="NotApproved" to="End"></transition>
             <node name="QuickCreditCheck">
             <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
             <transition name="toCheckLimit" to="InExcession">
             <action name="SetExcession" class="com.olf.workflowmgr.action.ReturntVarToVariableActionHandler">
             <xPathExpression>//value[../name = 'Excession']/text()</xPathExpression>
             <decision name="InExcession">
             <transition name="toValidate" to="ValidateDeal">
             "False".equalsIgnoreCase( (String)Excession )
             <transition name="GetCreditApproval" to="CreditApproval"></transition>
             <node name="ValidateDeal">
             <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
             <transition name="toEnd" to="End"></transition>
             <task-node name="CreditApproval">
             <task name="CreditManagerApproval" blocking="true">
             <assignment class="com.olf.workflowmgr.action.TaskAssignmentHandler">
             <transition name="Validate" to="ValidateDeal"></transition>
             <transition name="CreditNotApproved" to="End"></transition>
             <state name="ScriptFailed1">
             <transition name="Retry1" to="GatherSummaryData"></transition>

            Assignment Handler (the property assignee is set to "trader1"):
            package com.olf.workflowmgr.action;
            import org.jbpm.graph.exe.ExecutionContext;
            import org.jbpm.taskmgmt.exe.Assignable;
            import org.jbpm.taskmgmt.def.AssignmentHandler;
            import java.util.*;
             * Handler to assign a task to an actor or a pool of actors. The
             * assignee field is the actor id to assign to the task, or a
             * comma delimited list of actor ids to be assigned as a pool.
             * @author mholtzman
             * @version 0.1
            public class TaskAssignmentHandler implements AssignmentHandler {
             private String assignee;
             private static final long serialVersionUID = 1L;
             * Assigns the task.
             * @param assignable
             * the task to assign
             * @param executionContext
             * the context
             public void assign(Assignable assignable, ExecutionContext executionContext) {
             if (assignee == null) return;
             int idx = assignee.indexOf(",");
             if (idx < 0) {
             } else {
             String[] pool = assignee.split(",");
             } // assign
            } // class TaskAssignmentHandler

            • 3. Re: Task Assignment results in two tasks with same id
              boerse scholz Newbie

              Hi Michael, your code is great and for one user works fine, but when i assign in the websale app (for example) to bernie, cookie monster a task, it does not say "task assignet to bernie, cookie", it doesn't say anything and the tasks are not assigned, am i doing anything wrong? Thanx