AnsweredAssumed Answered

implemtation of email in pooled task workflow

Question asked by roxanne on Oct 16, 2008
Latest reply on Feb 25, 2009 by jarrett
Hi want to implement email notification  in our process definition .i am using group_assignees in our our workflow . but i am not able to get the email id of all the reviewers in the group.


My process defintion is as follows . now i want to implemement email notification in every transaction

can any one tell how to get email id of reviewer and approver in my transaction.

<?xml version="1.0" encoding="UTF-8"?>

<!– This describes a process for submitting changed content in a user –>
<!– sandbox, via one or more approval groups, to the staging sandbox. –>

<process-definition name="gmac:contentapprovesubmit">

  <!– ############## –>
  <!– Swimlane–>
  <!– ############## –>

<swimlane name="initiator">
  </swimlane>

<swimlane name="toAdministrator">
   <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
      <actor>#{people.getPerson("admin").properties["cm:userName"]}</actor>
      </assignment>
   </swimlane>



  <!– ############## –>
  <!– Initiate Workflow –>
  <!– ############## –>

   <start-state name="start">
        <task name="gmac:submitReviewTask" swimlane="initiator" >
   </task>
   <event type="node-leave">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      if (!bpm_package.children[i].hasAspect("gmac:WFStatus"))
                      {
                         bpm_package.children[i].addAspect("gmac:WFStatus");
                      }
                   }
               </script>
           </action>
       </event>
   
        <transition name="Initiate" to="authorverification">
   <!–  <condition>#{initiator.properties.userName == "admin"}</condition>  –>
   </transition>
   </start-state>




  <!– ############## –>
  <!– Author verification- Author needs to check the compliance for the content–>
  <!– ############## –>

<task-node name="authorverification">
        <task name="gmac:authorverification" swimlane="initiator" />
        <transition name="Abort" to="AdminInfo" />
        <transition name="Continue" to="submitpooledreview">
   
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "ComplianceChecked";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>

   </transition>
</task-node>





  <!– ############## –>
  <!– Pooled Review –>
  <!– ############## –>

  <node name="submitpooledreview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{bpm_groupAssignees}</foreach>
            <var>reviewGroup</var>
        </action>
        <transition name="review" to="pooledreview" />
    </node>

   <swimlane name="Reviewers">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <!– <pooledactors>#{people.getGroup('GROUP_Reviewers')}</pooledactors> –>
         <pooledactors>#{reviewGroup}</pooledactors>
      </assignment>
  </swimlane>

 
  <task-node name="pooledreview">
    <task name="gmac:reviewTask" swimlane="Reviewers">
    </task>
     <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "WithReviewer";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
       </event>
       
   <transition name="Approve" to="onapprove">
   </transition>
   <transition name="Reject" to="rejected" >
       </transition>
</task-node>





  <!– ############## –>
  <!– End the Review –>
  <!– ############## –>

      <task-node name="rejected">
        <task name="gmac:rejectedTask" swimlane="initiator" >
    </task>
   <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "Rejected";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
       </event>
       
        <transition name="Abort" to="AdminInfo" />
        <transition name="Resubmit" to="submitpooledreview"/>       
   
    </task-node>

    <decision name="onapprove">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "Approved";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
       <transition name="launchnow" to="authorCertify" />
       <transition name="launchpending" to="submitpending">
           <condition>#{wcmwf_launchDate != null}</condition>
       </transition>
    </decision>

     <task-node name="submitpending">
        <task name="gmac:submitpendingTask" swimlane="toAdministrator">
           <event type="task-create">
              <script>
                 taskInstance.dueDate = wcmwf_launchDate;

              </script>
           </event>
      <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "SubmitToStagingPending";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
       </event>
           <timer duedate="#{wcmwf_launchDate}" transition="launch" >
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                   <script>
                      logger.log("WCM Submission " + bpm_workflowDescription + " submitted at " + wcmwf_launchDate + " by " + person.properties.userName);
                   </script>
               </action>
           </timer>
        </task>
        <transition name="cancel" to="AdminInfo" />
        <transition name="launch" to="authorCertify" />
    </task-node>

  





     <!– ############## –>
  <!– Certification fron Author –>
  <!– ############## –>

    <task-node name="authorCertify">
        <task name="gmac:authorCertify" swimlane="initiator" />
        <transition name="Submit" to="decisionCertify"/>
    </task-node>


<decision name="decisionCertify">
        <transition name="Certified" to="Submitted" >
    <condition>#{gmac_checkCertify != "Not Certified"} </condition>
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "Certified";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
   </transition>
     <transition name="NotCertified_End" to="AdminInfo" >
    <condition>#{gmac_checkCertify == "Not Certified"} </condition>
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "NotCertified";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
   </transition>
</decision>




   <node name="Submitted">
        <event type="node-enter">
           <action class="org.alfresco.repo.avm.wf.AVMSubmitPackageHandler"/>
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                   for (var i = 0; i &lt; bpm_package.children.length; i++)
                   {
                      bpm_package.children[i].properties["gmac:status"] = "SubmitToStagingPending";
                      bpm_package.children[i].save();
                   }
               </script>
           </action>
        </event>
        <transition name="AdministratorInformation" to="AdminInfo" />
    </node>






   <!– ############## –>
    <!– End the Process –>
    <!– ############## –>
  
     <task-node name="AdminInfo">
         <task name="gmac:AdminInfo" swimlane="toAdministrator" />

    <timer duedate='3 minutes' transition="End" >
              <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                   <script>
                      logger.log("WCM Submission " + bpm_workflowDescription + " submitted at " + wcmwf_launchDate + " by " + person.properties.userName);
                   </script>
               </action>
           </timer>
        <transition name="End" to="endfinal" />
    </task-node>

    <end-state name="endfinal"/>

    <event type="process-end">
        <action class="org.alfresco.repo.avm.wf.AVMRemoveAllSrcWebappsHandler"/>
        <action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
    </event>

</process-definition>


Outcomes