cancel
Showing results for 
Search instead for 
Did you mean: 

Email notification for new replies on any forum

bruno_borges
Champ in-the-making
Champ in-the-making
Is it possible to define that  Alfresco should notify subscribed users that some forum/discussion/thread has new replies?

[]'s
13 REPLIES 13

raf
Champ in-the-making
Champ in-the-making
Is it possible to define that  Alfresco should notify subscribed users that some forum/discussion/thread has new replies?

[]'s
This query is almost a year old. I have the same question. Does anyone know the answer?

Thanks,
Martin

kevinr
Star Contributor
Star Contributor
There is no UI or config to do this. But, you can setup a Rule that fires when any InBound object is created/modified, and you can use the JavaScript to see what type of object that is (See the forumModel.xml in the Alfresco distribution) and then send an email again using the JavaScript API - so it is possible but not as easy as point-and-click Smiley Happy
http://wiki.alfresco.com/wiki/JavaScript_API

Kevin

nuandaeb
Champ in-the-making
Champ in-the-making
There is no UI or config to do this. But, you can setup a Rule that fires when any InBound object is created/modified, and you can use the JavaScript to see what type of object that is (See the forumModel.xml in the Alfresco distribution) and then send an email again using the JavaScript API - so it is possible but not as easy as point-and-click Smiley Happy
http://wiki.alfresco.com/wiki/JavaScript_API

Kevin


Kevin, could you point us to an example of how the Javascript API could be used in this specific instance? Or could you provide an outline if no example exists?

Without this feature, we probably won't be able to get approval for deploying Alfresco in our organization.

Thanks,

EB

dmatejka
Champ in-the-making
Champ in-the-making
I'm wondering …whether RSS feed could not do the job for you?

best regards,

Daniel

kevinr
Star Contributor
Star Contributor
There is no UI or config to do this. But, you can setup a Rule that fires when any InBound object is created/modified, and you can use the JavaScript to see what type of object that is (See the forumModel.xml in the Alfresco distribution) and then send an email again using the JavaScript API - so it is possible but not as easy as point-and-click Smiley Happy
http://wiki.alfresco.com/wiki/JavaScript_API

Kevin, could you point us to an example of how the Javascript API could be used in this specific instance? Or could you provide an outline if no example exists?

Without this feature, we probably won't be able to get approval for deploying Alfresco in our organization.

The JavaScript API page provides a number of useful examples. But basically it would be a case of setting up an INBOUND rule against Type:Content that Executed a Script and "Apply rule to sub spaces".

The script itself would examine the current document to see if it was of type fmSmiley Tongueost and then use the Email repository action (see the Actions API in the JavaScript API docs - there is an example of emailing) to send whatever you want about the post - the content of the post or the posting username etc. could be extracted from the fmSmiley Tongueost object and sent with the email.

Kevin

ariellle
Champ in-the-making
Champ in-the-making
I want to do the same than bruno.borges.

I try to add a rule which execute a script for all new items created.

I don't know javascript so i write this script (which doesn't work) :


if (document.type == fm:post)
{

// create mail action
  var mail = actions.create("mail");
  mail.parameters.to = "me@mydomain.com";
  mail.parameters.subject = "Hello from JavaScript";
  mail.parameters.from = "alfresco@alfresco.com";
  mail.parameters.text = "new forum";
  // execute action against a document   
  mail.execute(doc);

}

Can you help me to find a correct script?

Thanks,

nuandaeb
Champ in-the-making
Champ in-the-making
Kevin, thanks – that was very useful. I can execute a script when a post is produced. However, when I try the email example (that others have tried), it don't get an email.


I'm wondering if my problem has to do with the reference to the node 'doc' in the statement mail.execute(doc) in the code example below. Do I have to select a different node, and if so, how would I go about it? Total newbie question.


// create mail action
  var mail = actions.create("mail");
  mail.parameters.to = "davidc@alfresco.com";
  mail.parameters.subject = "Hello from JavaScript";
  mail.parameters.from = "davidc@alfresco.com";
  mail.parameters.template = root.childByNamePath("Company Home/Data Dictionary/Email Templates/notify_user_email.ftl");
  mail.parameters.text = "some text, in case template is not found";
  // execute action against a document   
  mail.execute(doc);

Thanks.

kevinr
Star Contributor
Star Contributor
The document node reference applied to the action is only used when constructing the model for the template if a template is used when generating the email. Basically you can pass any valid node to the execute() method if you are not using a template as it won't get used anyway - probably "document" or similar. The problem is probably that the "doc" object reference does not exist in your script, so try "document" instead.

Kevin

kevinr
Star Contributor
Star Contributor
I think you may be able to just pass "null" if you are not using a template i.e.

mail.execute(null);

Kevin