AnsweredAssumed Answered

Email on Assigning Task to a Colleague - Adhoc Task

Question asked by joshua on Aug 3, 2012
Latest reply on Jun 9, 2014 by carlsutcliffe
Hi,

I am using Alfresco 3.4.0 (d).

Using alfresco share, i am assigning task to a colleague using Adhoc task. While assigning a task, i want a email notification to go to both creator and assignee. I tried using the following changes.

File placed in the location "/opt/alfresco-3.4.b/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow" was changed as below.


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

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

   <swimlane name="initiator"/>

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

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>
  
   <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>
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
                  {
               var mail = actions.create("mail");
               mail.parameters.to = bpm_assignee.properties.email;
               mail.parameters.subject = "Adhoc Task: " + bpm_workflowDescription;
               mail.parameters.from = initiator.properties.email;
               mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Notify Email Templates/notify_user_assigned_task_email.ftl");
               mail.parameters.text = "A task was created.";
               mail.execute(bpm_package);
               }
      </script>
            </action>
         </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.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Notify Email Templates/notify_initiator_completed_task_email.ftl");
                 mail.parameters.text = "This task is done.";
                 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>


Alfresco service was restarted after making the above changes, but I didnt get any email notification on assigning task.

Any help would be greatly appreciated.


Thanks,

Binu Manickkam.

Outcomes