AnsweredAssumed Answered

Mail non envoyé dans workflow

Question asked by nokolyo on May 26, 2009
Latest reply on Jul 1, 2009 by nokolyo
Bonjour,

J'utilise la version 3.0 d'Alfresco. J'essaie de modifier le process definition du workflow d'exemple "Group Review & Approve".
Je souhaite envoyer un mail lors de la décision de l'approbateur. Pour cela j'ai modifié les tâches "rejected" et "approved" afin d'envoyer un mail.
Mon problème est que je ne reçois aucun mail et aucune erreur. J'ai essayé de voir ce qu'il ce passait avec logger.log mais je n'obtiens rien dans le fichier alfresco.log, pourtant j'ai configuré log4j.properties en mettant

log4j.logger.org.alfresco.repo.jscript=debug

j'ai mis plusieurs logger.log et mail dans le workflow mais rien ne se passe. Pourtant je vais jusqu'au bout du workflow correctement.
Quant j'essaie de voir ce qu'il se passe dans un autre workflow pour tester, le AdhocTask, tout fonctionne bien sauf le logger.

Voici le process definition du workflow parallelgroupreview que j'essaie de faire fonctionner pour l'envoie de mail.
Pouvez-vous m'aider à résoudre mon prolbème, s'il vous plaît, car je suis à cours d'idée.

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:parallelgroupreview">

    <swimlane name="initiator"/>

    <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator" />
        <transition name="" to="startreview">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
                var mail = actions.create("mail");
                mail.parameters.to = initiator.properties.email;
                mail.parameters.subject = "Debut workflow";
                mail.parameters.from = "it@xxx.fr";
                mail.parameters.text = "GO TU VA MARCHER";
                mail.execute(bpm_package);
            </script>
         </action>
      </transition>
    </start-state>

    <node name="startreview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{people.getMembers(bpm_groupAssignee)}</foreach>
            <var>reviewer</var>
        </action>
        <event type="node-enter">
            <script>
                <variable name="wf_approveCount" access="write" />
                <expression>
                    wf_approveCount = 0;
                </expression>
            </script>
        </event>
        <transition name="review" to="review" />
    </node>

    <task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
        </task>
        <transition name="reject" to="endreview">
        </transition>
        <transition name="approve" to="endreview">
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
            </script>
        </transition>
    </task-node>

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_reviewerCount" access="write"/>
                 <expression>people.getMembers(bpm_groupAssignee).length;</expression>
              </script>
           </action>
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_requiredPercent" access="write"/>
                 <expression>wf_requiredPercent = wf_requiredApprovePercent;</expression>
              </script>
           </action>
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_actualPercent" access="write"/>
                 <expression>wf_actualPercent = ((wf_approveCount * 100) / people.getMembers(bpm_groupAssignee).length);</expression>
              </script>
           </action>
        </event>
        <transition name="reject" to="rejected"></transition>
        <transition name="approve" to="approved">
            <condition>#{wf_actualPercent >= wf_requiredApprovePercent}</condition>
      </transition>
   </decision>
              
    <task-node name="rejected">
        <task name="wf:rejectedParallelTask" swimlane="initiator"/>
        <transition to="end">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
                logger.log("Email " + initiator.properties.email);
                var mail = actions.create("mail");
                mail.parameters.to = initiator.properties.email;
                mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                mail.parameters.from = "it@xxxxxx.fr";
                mail.parameters.text = "Document rejected";
                mail.execute(bpm_package);
            </script>
         </action>
      </transition>
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedParallelTask" swimlane="initiator"/>
        <transition to="end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                    logger.log("Email " + initiator.properties.email);
                   var mail = actions.create("mail");
                   mail.parameters.to = initiator.properties.email;
                   mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                   mail.parameters.from = "it@xxx.fr";
                   mail.parameters.text = "Document approved";
                   mail.execute(bpm_package);
               </script>
            </action>
      </transition>
    </task-node>

    <end-state name="end"/>

   <event type="process-end">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            logger.log("End of process.");
             var mail = actions.create("mail");
             mail.parameters.to = initiator.properties.email;
             mail.parameters.subject = "FIN du workflow";
             mail.parameters.from = "it@xxx.fr";
             mail.parameters.text = "FIN !!!!!!!!!";
             mail.execute(bpm_package);
         </script>
      </action>
   </event>

   
</process-definition>

Outcomes