AnsweredAssumed Answered

Workflow notification and templates

Question asked by livier on Sep 10, 2018
Latest reply on Sep 18, 2018 by jpotts

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

Outcomes