AnsweredAssumed Answered

Javascript to send mails only to site managers

Question asked by gmce on Sep 15, 2012
Latest reply on Sep 22, 2012 by gmce
Hello everyone, i successfully created a javascript (triggered by rules) that sends mail notification to all site users.

var parent = space.getParent();
var siteShortName = space.getSiteShortName();
var siteGroup = "GROUP_site_" + siteShortName;

var template = "Dizionario dei dati/Modelli di e-mail/Modelli di e-mail di notifica/notifica_documento_aggiunto.html.txt";

// create mail action
var mail = actions.create("mail");
mail.parameters.to_many = siteGroup;

mail.parameters.subject="Nuovo Documento nel progetto " + siteShortName;
//mail.parameters.text="blablabla";
mail.parameters.template = companyhome.childByNamePath(template);

//execute action against a document
mail.execute(document);

Now i am trying to modify this script to send mails only to the managers of the site.
I've tried the function site.memberList(null,manager,null) but if i have understood correctly the result is a map and not an array.

Thanks in advance.

P.S. using Alfresco Community 4.0.d

Outcomes