AnsweredAssumed Answered

Send mail to Assignee of Adhoc Workflow.

Question asked by orbitron on Feb 7, 2011
Latest reply on Feb 8, 2011 by orbitron
Hello all,

I have seen several topics related with my problem, but after read all of them I can not understant why is not working my configuration. Just say that I receive the mails correctly when the workflow is complete and the "Notify me" checkbox is select, so I assume all the mail configuration is correct. But It is impossible for me configure Alfresco to send a message to the Assignee when the task is created.
Any help or hint will be appreciate.
Here I posted my adhoc_proccessdefinition.xml, thanks in advance.
Note: I have tried also with hardcoded mail address instead of "bpm_assignee.properties.email, etc"


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

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

   <swimlane name="initiator"/>

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

   <start-state name="start">
      <task name="wf:submitAdhocTask" swimlane="initiator"/>
       <transition name="" to="adhoc">
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
            <!– Send a notification email to the reviewer –>
            var mail = actions.create("mail");
            mail.parameters.to =  bpm_assignee.properties.email;
            mail.parameters.subject = "New Task";
            mail.parameters.from = initiator.properties.email;
            mail.parameters.text = "Test";
            mail.execute(bpm_package);
          </script>
        </action>
     </transition>
   </start-state>

   <task-node name="adhoc">
      <task name="wf:adhocTask" swimlane="assignee">
              <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="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (wf_notifyMe)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done! Task has been finished.";
                 mail.execute(bpm_package);
              }
           </script>
         </action>
      </transition>
   </task-node>

   <task-node name="completed">
      <task name="wf:completedAdhocTask" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>

   <end-state name="end"/>

</process-definition>

Outcomes