10-18-2016 06:33 PM
I would like to create a new notification that is sent to the author of the document and the commenter when a new comment is added on a document. Can anyone let me know how I can achieve this?
10-19-2016 04:04 AM
You can develop a custom behaviour for that.
Listen to 'onContentUpdate' event for 'ForumModel.TYPE_POST' types and send the email by using an action 'MailActionExecuter.NAME'
10-19-2016 04:16 AM
Probably the easiest way to do this is to create a rule that is configured to run a script when the document is updated.
From the script you can then use the mail action e.g.
var template = "Data Dictionary/Email Templates/Notify Email Templates/xxxxx.ftl";
var mail = actions.create("mail");
var creator = document.properties["cm:creator"];
var peep = people.getPerson(creator);
mail.parameters.to = peep.properties["cm:email"];
mail.parameters.subject="Document changed: "+document.properties.title;
mail.parameters.template = companyhome.childByNamePath(template);
mail.execute(document);
You don't need to use a template but it's nicer if you do.
10-19-2016 04:18 AM
Interesting, where do you include such rule? At 'Repository > Sites'?
10-19-2016 04:48 AM
I think the original question was asking about a document rather than a discussion post.
If adding the rule to site discussions then, yes in Repository > Sites ....
I've wrapped up Discussions notifications in an add on GitHub - malariagen/alfresco-discussions: Customizations to Alfresco Site Discussions that does rather more than just send out an email.
I'm not sure of the pros and cons of behaviour vs rule but in this case I think a rule gives more flexibility.
10-19-2016 04:58 AM
In fact, a document comment is modelled as a discussion post: they both are sharing content model.
So, I have to add that the behaviour should check if the new POST is happening inside 'documentLibrary' component.
IMO, behaviours are more efficient than rules, as they are only listening to events inside node lifecycle. However, rules must consider all containing folder hierarchy also as triggering condition, which in the end can involve too much overload for the system.
10-19-2016 05:20 AM
Interesting about the shared content model.
I wouldn't think it's a good idea to use a rule everywhere, so I agree a behaviour is probably better in that case.
It might be easier to check if the post is not in a discussion.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.