01-09-2018 06:57 AM
Hi,
I am want to replace Alfresco in OOTB email templates with my custom name let say ABC.
As I might need to do for many clients, replacing Alfresco from all the email templates every time for each client doesn't seems feasible, hence I want to replace it with an object that can be used as placeholder for the clients name similar to shareUrl object in the email templates
E.g.
in following-email.html.ftl we have a line Sincerely Alfresco I want replace it with Sincerely ${myObject} this myObject will contain the name of the client ABC.
myObject value will be defined in alfresco-global.propsand the templates will be bootstrapped using ImportComponentModule.
Thanks
Hiten Rastogi
01-10-2018 01:22 AM
This is sample script code to send email.
var mail = actions.create("mail");
mail.parameters.to_many = "user_email";
mail.parameters.subject = "Notification review";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/EMail Templates/Email_Templates.ftl");
var templateArgs = new Array();
templateArgs['name'] = person.properties.firstName+" "+person.properties.lastName;
var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;
mail.executeAsynchronously(person);
And this is email template file place this file under the path Data Dictionary/EMail Templates/Email_Templates.ftl
<html>
<head>
</head>
<body bgcolor="white">
<div>
<p>Hi <b>${args.name},</b></p>
</div>
</body>
</html>
companyhome.childByNamePath("Data Dictionary/EMail Templates/Email_Templates.ftl");
This path defines the location of your email template.
We need to pass templateArgs array values to template_model.
Thanks,
Kalpesh
01-10-2018 01:27 AM
Hi Kaplesh,
Thanks for your response but what I am seeking is an object that is similar to shareUrl that can contain my value and can be used in any email templates without worrying to passing it in the template model every time.
Thanks
01-10-2018 05:27 AM
I was able to achieve this by using message object.
Putting this ${message("client.name")} in the email templates helped me picked up the value for the labels from my properties file in the repo.
Thanks
Explore our Alfresco products with the links below. Use labels to filter content by product module.