AnsweredAssumed Answered

Email notification on a datalist advanced task

Question asked by naas79 on Mar 30, 2015
Latest reply on Mar 30, 2015 by naas79
Hi, first of all, I'm new on alfresco, and I'm not a developer, so maybe my question can be obvious for a lot of people.
I'm using alfresco community 4.2f on a linux ubuntu 14 platform and I'm testing some features like datalists.
I wrote a javascript to send emails when an advanced task is created in a datalist, to users who are assigned to.To do this I use a rule on the datalist directory and a javascript.
Here's the code below :
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
var person=document.assocs["dl:taskAssignee"][0];
var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];
var email = person.properties.email
// create mail action

var mail = actions.create("mail");


mail.parameters.to = email;

mail.parameters.subject = "Nouveau document déposé";

mail.parameters.from = "admin@alfresco";

mail.parameters.template = companyhome.childByNamePath("mytemplate");

mail.parameters.text = some text;


mail.execute(person);
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

If I've 2,3 persons assigned to an advanced task, an email is sent only to the first user assigned but not to the others.
I think I need a "for loop" to get all assignees in "dl:taskassignee" but i don't know how to do that.

If somebody got an idea, I'll be really greatfull.
Regards.

Emmanuel Naas.

Outcomes