AnsweredAssumed Answered

Timer Boundary Event and User task assignee

Question asked by vincent-kali on May 11, 2018
Latest reply on May 15, 2018 by vincent-kali

I want to send an email reminder to each user task assignee (multiinstance task) after a given period a time. A Timer Event is bound to the user task and triggers a service task (AlfrescoScriptDelegate) that should send an email to the user task assignee.

My problem/question:

   Task object is not available in AlfrescoScriptDelegate context, and I don't know how to get the userTask assignee.

My code: 

 

<code>

    <userTask id="buyerApprovalLevel1Task" name="Buyer approval level 1 user task" activiti:assignee="${buyerApprovalLevel1Assignee.properties.userName}" activiti:formKey="supplierinvoice:buyerApprovalLevel1Task">
      <documentation>Buyer approval level 1 user task</documentation>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="supplierinvoice_buyerApprovalLevel1Assignees" activiti:elementVariable="buyerApprovalLevel1Assignee">
        <completionCondition>${wf_buyerApprovalLevel1TaskOutcome != 'NONE'}</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>

    <boundaryEvent id="buyerApprovalLevel1TaskTimer" name="Timer" attachedToRef="buyerApprovalLevel1Task" cancelActivity="false">
      <timerEventDefinition>
        <timeCycle>${wf_reminderCronExpression}</timeCycle>
      </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flowBuyerApprovalLevel1TaskTimerOut" sourceRef="buyerApprovalLevel1TaskTimer" targetRef="buyerApprovalLevel1Reminder"></sequenceFlow>
    <serviceTask id="buyerApprovalLevel1Reminder" name="Buyer approval level1 email reminder" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
        <activiti:field name="runAs">
          <activiti:string><![CDATA[wfservice-supplierinvoice]]></activiti:string>
        </activiti:field>
        <activiti:field name="script">
          <activiti:string><![CDATA[
    
    ?? task object is not available here, how to get userTask assignee ??
    
    ]]></activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>

</code>

 

 

Thanks for your help.

Vincent

Outcomes