AnsweredAssumed Answered

Send mail to all users of a pooled task

Question asked by chicco0386 on May 2, 2011
Latest reply on May 11, 2011 by chicco0386
Hi all,
I'm trying the right way for send an email notification to all users assigned to a pooled task.
I've read inside the forum and the most used way is use a ForEachFork action, my code is this:
<node name="Invia mail a marketing">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{tria_marketing}</foreach>
            <var>currentMarketingUser</var>
       </action>
      <transition to="Revisione marketing">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                 <script>
                    var mail = actions.create("mail");
                    mail.parameters.to = currentMarketingUser.properties.email;
                    mail.parameters.subject = "Test Document Task " + bpm_workflowDescription;
                    mail.parameters.text = "PPROVA";
                    mail.execute(bpm_package);
                 </script>
            </action>
      </transition>
   </node>
<task-node name="Revisione marketing">
      <task name="wfTria:revisioneMarketing" swimlane="marketing"></task>
      <transition to="Richiedi nuovamente qualifica PM" name="Richiedi nuovamente qualifica PM"></transition>
      <transition to="Approvazione direzione commerciale o marketing" name="Revisionato"></transition>
   </task-node>

With this code the mails are send to all users inside the pool, but the next task inside the code is create N (N=number of pooled users) time for each users. This is not correct.

Can you help me and say where I do the mistake?
Thanks

Outcomes