cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow notification and templates

livier
Confirmed Champ
Confirmed Champ

Hi,

 

I try to use the default template for my workflow notifications but I get a 500 error code

 

The notification works if I use these folowings :

var mail = actions.create("mail");
mail.parameters.to = initiator.properties.email;
 mail.parameters.subject = "Adhoc Task " + execution.getVariable('bpm_workflowDescription');
mail.parameters.from = initiator.properties.email;
mail.parameters.text = "It's done";
mail.execute(bpm_package);

However, I get a 500 error code when I use this :

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

mail.parameters.to = initiator.properties.email;
mail.parameters.template =companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html.ftl");
var templateArgs = new Array();
templateArgs['workflowTitle'] = "workflowTitle";
var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;  
//mail.parameters.text = "";
mail.parameters.subject = "Adhoc Task " + execution.getVariable('bpm_workflowDescription');
mail.parameters.from = initiator.properties.email;
mail.execute(bpm_package);

The log :

 

2018-09-07 08:18:19,959  ERROR [action.executer.MailActionExecuter] [http-bio-8080-exec-26] Failed to send email to adresse@mail.com : org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: No MimeMessage content; message exceptions (1) are: Failed message 1: javax.mail.MessagingException: No MimeMessage content
 2018-09-07 08:18:19,969  DEBUG [repo.jscript.ScriptLogger] [http-bio-8080-exec-26] org.alfresco.scripts.ScriptException: 08070022 Failed to execute supplied script: 08070021 Failed to send email to:adresse@mail.com
 2018-09-07 08:18:19,970  DEBUG [repo.jscript.ScriptLogger] [http-bio-8080-exec-26] Returning 500 status code

 

When I add this :

logger.log("Template : " + companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html.ftl"));

logger.log("Template_Data : " + companyhome.childByNamePath("Data Dictionary"));

I get :

Template : null

Template_Data : null

Thanks in advance

11 REPLIES 11

livier
Confirmed Champ
Confirmed Champ

Thanks for your answer.
From now, I am the only one who use the application.

In the node browser when I seach with the noderef of the invite-email_fr.html.ftl file, I get the primary path /app:company_home/app:dictionary/app:email_templates/cm:workflownotification/cm:invite-email_fr.html.ftl

jpotts
World-Class Innovator
World-Class Innovator

Well, that is strange. If you are logged in to Share as admin and you can browse and search for that template, you should be able to use the JavaScript Console to run that print statement and it should work.