cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow notification email

outlandish
Champ in-the-making
Champ in-the-making
I am a new Alfresco developer. I would like to change the default email that is sent to the assignee when they are assigned a task.

I would like to add the name of the document that needs to be reviewed to the subject line. The file that needs to be edited is the notification-services.properties file in /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/messages/. The part that needs to be edited is 'assigned-task=' but I need to know how to add the document name to that line.

I would also like to be able to add the name of the assignee in the message body but I am not sure what variable to add to the wf-email.html.ftl file.

Thank you for reading and all responses are much appreciated.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can't add the document name in the .properties file. You can only insert a placeholder, e.g. like this:
message.searchingFor=Searching for "{0}"…
In order for the name of the document to be inserted into the subject, you need to adapt the code that generates the subject line, so it passes the required value into the message.

Regards
Axel

outlandish
Champ in-the-making
Champ in-the-making
I solved the issue by editing the WorkflowNotificationUtils.java file.

I captured document name and assignee name into strings:

String assignee = "";
   String fileName = "";

   //put all document names in string fileName
   if (workflowPackage != null)
   {
      List<ChildAssociationRef> children = services.getNodeService().getChildAssocs(workflowPackage);
      for (ChildAssociationRef childAssoc : children) {
         
         NodeRef childNodeRef = childAssoc.getChildRef();
         fileName = fileName + (String) services.getNodeService().getProperty(childNodeRef, ContentModel.PROP_NAME) + ", ";
      }
      fileName = fileName.substring(0, fileName.length() - 2);
   }
      
   //get assignee name
   for (String assignedAuthority : assignedAuthorites)
   {
      assignee = assignee + assignedAuthority;
   }

   NodeRef p = services.getPersonService().getPerson(assignee);
        if (p != null)
        {
            assignee = (String) services.getNodeService().getProperty(p, ContentModel.PROP_FIRSTNAME);
        }

I then added the document name to the subject line directly. And the assignee name into templateArgs after that I was able to call it in wf-email.html.ftl.


subject = "Needs approval - " + fileName;
——————————————————————-
templateArgs.put(ARG_ASSIGNEE, assignee);

Please advice if there is a better way to do this. Thank you.