AnsweredAssumed Answered

Multi Instance Task does not assign approvers

Question asked by dhrobbins on Apr 12, 2017
Latest reply on Apr 13, 2017 by dhrobbins

I have a workflow in Alfresco Share where I need 4 parallel reviews / approval tasks.  I am currently able to create 4 tasks but they all go to the same candidate group.  Members of that group are able to approve, but they have all 4 tasks in their "My Tasks".  Each of these tasks is unassigned.  The remaining 3 groups receive no tasks.

 

Do I need to include code in the multiInstanceLoopCharacteristics that assigns the tasks to the pooled actors?  I have read the documentation Activiti User Guide and see that a list of users can be created.  Where would I set that variable and would that be with execution.setVariable()?  Any help would be greatly appreciated.

 

<userTask id="miTasks" name="My Task ${loopCounter}" activiti:assignee="${assignee}">
  <multiInstanceLoopCharacteristics isSequential="false">
    <loopDataInputRef>assigneeList</loopDataInputRef>
    <inputDataItem name="assignee" />
  </multiInstanceLoopCharacteristics>
</userTask>

 

Here is my code:

 

<userTask id="userTask10" name="Approvers Review" activiti:candidateGroups="GROUP_accountsManager,GROUP_manfacturingManager,GROUP_engineeringManager,GROUP_qualityManager" activiti:formKey="lec:appoversreview">
   <documentation>Review task
      Note:  When a reject occurs, workflow is routed back to Originator assign, bypassing other approvers.
   </documentation>
   <extensionElements>
      <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
         <activiti:field name="script">
            <activiti:string>
               <![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
                  if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;;]]>
            </activiti:string>
         </activiti:field>
      </activiti:taskListener>
      <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
         <activiti:field name="script">
            <activiti:string>
               <![CDATA[execution.setVariable('lec_appoversreviewtransitions',task.getVariableLocal('lec_appoversreviewtransitions') );
                  if(task.getVariableLocal('lec_appoversreviewtransitions') == 'Approve') {
                  execution.setVariable('lec_appoversreviewapprovalcount', lec_appoversreviewapprovalcount + 1);
                  }
                 
                  if(task.getVariableLocal('lec_appoversreviewtransitions') == 'Reject') {
                    execution.setVariable('lec_appoversreviewapprovalcount',5);
                    execution.setVariable('lec_appoversreviewtransitions', task.getVariableLocal('lec_appoversreviewtransitions'));
                  }
                 
                  logger.info("Count: " + execution.getVariable('lec_appoversreviewapprovalcount') )]]>
            </activiti:string>
         </activiti:field>
      </activiti:taskListener>
   </extensionElements>
   <multiInstanceLoopCharacteristics isSequential="false">
      <loopCardinality>4</loopCardinality>
      <completionCondition>${lec_appoversreviewapprovalcount &gt;= lec_appoversreviewrequiredapprovalcount}</completionCondition>
   </multiInstanceLoopCharacteristics>
</userTask>
<exclusiveGateway id="exclusiveGateway1"></exclusiveGateway>
<sequenceFlow id="sequenceFlow22" sourceRef="userTask10" targetRef="exclusiveGateway1"></sequenceFlow>
<sequenceFlow id="sequenceFlow23" name="Rejected" sourceRef="exclusiveGateway1" targetRef="userTask9">
   <conditionExpression xsi:type="tFormalExpression">
      <![CDATA[${lec_appoversreviewtransitions == 'Rejected'}]]>
   </conditionExpression>
</sequenceFlow>
<sequenceFlow id="sequenceFlow24" name="Approved" sourceRef="exclusiveGateway1" targetRef="exclusiveGateway2"></sequenceFlow>
<exclusiveGateway id="exclusiveGateway2"></exclusiveGateway>

Outcomes