AnsweredAssumed Answered

Send email in create listener of multi instance email.

Question asked by mstein on Sep 5, 2012
Latest reply on Sep 5, 2012 by mstein
Hi All,

I have a workflow with a multi-instance task and I want to email the assignee on create. I have some code that looks like this:

<userTask id="alfrescoUsertask1" name="Review Task" activiti:assignee="${reviewAssignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>logger.log("review task for:" + reviewAssignee.properties.userName);
var mail = actions.create("mail");
mail.parameters.to = reviewAssignee.properties.email;
mail.parameters.subject = "Review Task Assignment: " + bpm_package.children[0].properties.name;
mail.parameters.text = "Review this now!";
mail.execute(bpm_package);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="bpm_assignees" activiti:elementVariable="reviewAssignee"></multiInstanceLoopCharacteristics>
    </userTask>


For some reason reviewAssignee.properties.email is blank, reviewAssignee.properties.userName works fine and initiator.properties.email is good too.

Any thoughts?

Thanks,
Max

Outcomes