Workflow con envío de emails

cancel
Showing results for 
Search instead for 
Did you mean: 
witho
Active Member

Workflow con envío de emails

Hola,

Estoy intentando crear un Workflow que se lance con una regla que ejecuta un javascript (workflow.js). El problema es que quiero modificar el archivo review_processdefinition.xml para mandar mails cuando se apruebe o rechace el documento en cuestión. Posteo mis archivos de configuración para ver si alguien me puede ayudar ya que no se envían los emails ni encuentro traza de error alguna en el log del tomcat.

workflow.js

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = "Asier.";
workflow.parameters["bpm:assignee"] = "ahernandez";
workflow.execute(document);

review_processdefinition.xml

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

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

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <transition name="" to="review" />         
    </start-state>

    <swimlane name="reviewer">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{bpm_assignee}</pooledactors>
      </assignment>      
    </swimlane>

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
        </task>
        <transition name="reject" to="rejected" />
        <transition name="approve" to="approved" />
    </task-node>

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator"/>
        <transition name="" to="end" >
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               var mail = actions.create("mail");
               mail.parameters.to = "ahernandez@theinit.com";
               mail.parameters.subject = "Document approved ";
               mail.parameters.from = "ahernandez@theinit.com";
               mail.parameters.text = "It's done";
               mail.execute(document);               
            </script>
         </action>
      </transition>
   </task-node>
   
   <task-node name="approved">
        <task name="wf:approvedTask" swimlane="initiator" />
        <transition name="" to="end" >
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>               
               
               var mail = actions.create("mail");
               mail.parameters.to = "ahernandez@theinit.com";
               mail.parameters.subject = "Document rejected ";
               mail.parameters.from = "ahernandez@theinit.com";
               mail.parameters.text = "It's done";
               mail.execute(document);               
            </script>
         </action>
      </transition>      
    </task-node>   
   
    <end-state name="end" />

</process-definition>

repository.properties


# Email configuration
mail.host = mail.theinit.com
mail.port = 25
mail.transport.protocol = smtp
mail.username = prueba@theinit.com
mail.password = *********
mail.encoding=ISO-8859-1

Espero que alguien me pueda echar una mano. Muchas gracias.
1 Reply
witho
Active Member

Re: Workflow con envío de emails

SOLUCIONADO

El problema es que nos e me desplegaban los cambios en el workflow de revision. Para ello he modificado el fichero "bootstrap-context.xml".

bootstrap-context.xml


        <bean id="workflowBootstrap" parent="workflowDeployer">
            <property name="workflowDefinitions">
                <list>
                    <props>
                        <prop key="engineId">jbpm</prop>
                        <prop key="location">alfresco/workflow/review_processdefinition.xml</prop>
                        <prop key="mimetype">text/xml</prop>
                        <prop key="redeploy">true</prop>
                    </props>

Espero que sirva de ayuda.