As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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?
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'
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.
Interesting, where do you include such rule? At 'Repository > Sites'?
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.
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.