cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow email notifications - looking for advice!

upthorpe
Champ in-the-making
Champ in-the-making
First time poster looking for some advice really.

I'm trying to find a way to implement the automatic sending of emails based on elapsed time for a document under review. If a document is assigned to one or more users to review I'd like an email notification to be sent to each user to say that they should now review the document, and if they don't do this in say a week, for a further email to be sent out as a reminder and so on until they actually carry out the review - if the review didn't get carried out then an email to a manager would be desirable as well.

I'm not an expert in Alfresco but I've installed it on Windows and Unix successfully and I think I'm starting to understand how it hangs together as most things seem to work well - has anyone tried to implement something similar?, would it need to be done with a rule and a script?

Any help gratefully received!
1 REPLY 1

bucklao
Champ in-the-making
Champ in-the-making
What you will need to do is add a timer to the task-node in your workflow.  I have a sample below:

<task-node name="deptHead review">
      
      <task name="scwf:deptHeadReview" swimlane="deptHead">
      <timer name="sendNotification" duedate="1 minutes" repeat="1 minutes">
          <action name="sendNotification" class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <script>
            {
         var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Timer is working!!!";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
      }
            </script>
      </action>
      </timer>
      </task>

      <transition name="approve" to="end1">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow has been Approved by the Department Head";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>
      <transition name="reject" to="admin review">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow needs to be Revised by Admin Group";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>

   </task-node>

All you need to do is specify the time you want the email notifications to sent out.  Hopefully this helps you out.

BuckLao-