02-05-2010 11:08 AM
<action-group id="doc_details_actions">
<action idref="envoi_mail_u" />
<action id="envoi_mail_u">
<label-id>envoi_mail</label-id>
<image>/images/icons/email_users.gif</image>
<script>/Company Home/Data Dictionary/Scripts/mail_aux_utilisateurs.js</script>
</action>
var persons = [];
var perms = document.getPermissions();
for(var i=0 ; i<perms.length ; i++) {
var perm = perms[i].split(";");
if(perm[0] == "ALLOWED" && perm[1].lastIndexOf("GROUP_") != -1) {
var group = people.getGroup(perm[1]);
if(group)
var persons = people.getMembers(group);
for each (person in persons){
if(person.properties.userName != "admin" && person.properties.userName != "guest"){
var email = person.properties.email;
if(email)
sendMail(email);
}
}
}
}
function sendMail(email){
// Envoi mail
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Document Mis a Jour";
mail.parameters.from = "Info@Alfresco";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/diffusion_document.ftl");
mail.parameters.text = "Nouveau document";
mail.execute(document);
}
Le script utilisé par l'option 'Lancer une action' dans les détails du document fonctionne bien
org.alfresco.error.AlfrescoRuntimeException: Error during command servlet processing: Failed to execute script 'workspace://SpacesStore/ac628e1e-6283-4662-ad68-e119b3d4c0b6': ReferenceError: "document" n'est pas défini (AlfrescoScript#2)
caused by:
org.alfresco.scripts.ScriptException: Failed to execute script 'workspace://SpacesStore/ac628e1e-6283-4662-ad68-e119b3d4c0b6': ReferenceError: "document" n'est pas défini (AlfrescoScript#2)
caused by:
org.alfresco.error.AlfrescoRuntimeException: ReferenceError: "document" n'est pas défini (AlfrescoScript#2)
caused by:
org.mozilla.javascript.EcmaError: ReferenceError: "document" n'est pas défini (AlfrescoScript#2)
02-06-2010 06:07 AM
<action id="envoi_mail_u">
<label-id>envoi_mail</label-id>
<image>/images/icons/email_users.gif</image>
<script>/Company Home/Data Dictionary/Scripts/mail_aux_utilisateurs.js</script>
<params>
<param name="noderef">#{actionContext.nodeRef}</param>
</params>
</action>
var nodeRef = args["noderef"];
var document = search.findNode(nodeRef);
var nodeRef = args["noderef"];
var document = search.findNode(nodeRef);
var persons = [];
var perms = document.getPermissions();
for(var i=0 ; i<perms.length ; i++) {
var perm = perms[i].split(";");
if(perm[0] == "ALLOWED" && perm[1].lastIndexOf("GROUP_") != -1) {
var group = people.getGroup(perm[1]);
if(group) {
var persons = people.getMembers(group);
for each (person in persons){
if(person.properties.userName != "admin" && person.properties.userName != "guest") {
var email = person.properties.email;
if(email)
sendMail(email);
}
}
}
}
}
function sendMail(email) {
// Envoi mail
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Document Mis a Jour";
mail.parameters.from = "Info@Alfresco";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/diffusion_document.ftl");
mail.parameters.text = "Nouveau document";
mail.execute(document);
}
02-08-2010 08:35 AM
07-12-2011 08:28 AM
07-13-2011 08:09 AM
Dictionnaire de données / script
puis ajouter son script js.
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.