Found the solution :
Use the variable ${item.data.comment} in the default en.txt
Hi All,
We are facing issues in capturing previous comment entered by a participant in the default email template used by workflows. There are limited set of variables that can be used in the email as per the documention. Is there any way we can send comments by adding another variable in the same template.
https://docs.adobe.com/docs/en/aem/6-2/administer/operations/notification.html
Views
Replies
Total Likes
You can write a custom email step that uses Java and email templates and then place any variable that you want in the email. Setting variables in a email template involves setting a Java MAP where the key is the name of the variable and the value is the value that is injected into the email template when its sent.
For example...
//Creare a MAP to populate the email template variables
Map myMap =
new
HashMap() ;
String timeStamp =
new
SimpleDateFormat(
"yyyy.MM.dd.HH.mm.ss"
).format(
new
Date());
//Populate the MAP with the values submitted from the HTL front end
myMap.put(
"topic.subject"
,TopicSubject);
myMap.put(
"time"
,timeStamp);
myMap.put(
"host.prefix"
,hostPrefix);
myMap.put(
"forum.url"
,forumUrl);
myMap.put(
"modifiedBy.fullname"
,modifiedByFullname);
myMap.put(
"topic.url"
,topicUrl);
myMap.put(
"post.message"
,message);
//Declare a MessageGateway service
MessageGateway<HtmlEmail> messageGateway;
//Specify the EMail template
String template =
"/etc/notification/email/html/com.day.cq.collab.forum/en.txt"
;
Resource templateRsrc = request.getResourceResolver().getResource(template);
MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.
class
));
HtmlEmail email = mailTemplate.getEmail(StrLookup.mapLookup(myMap), HtmlEmail.
class
);
email.setSubject(
"AEM Email Template"
);
//Inject a MessageGateway Service and send the message
messageGateway =
this
.messageGatewayService.getGateway(HtmlEmail.
class
);
messageGateway.send((HtmlEmail) email);
Views
Replies
Total Likes
Thanks,
I am aware of writing it as a custom step .. We could use acs-commons email service as well..
The problem is we have a number of workflows developed already and we dont want to rework on them by adding a custom process step in between all participant steps wherever email is sent.
Is there anyway we can access it in the default template itself.. Or if we can overlay the OOTB workflow email service
Views
Replies
Total Likes
preeti.bhaya wrote...
Thanks,
I am aware of writing it as a custom step .. We could use acs-commons email service as well..
The problem is we have a number of workflows developed already and we dont want to rework on them by adding a custom process step in between all participant steps wherever email is sent.
Is there anyway we can access it in the default template itself.. Or if we can overlay the OOTB workflow email service
Found the solution :
Use the variable ${item.data.comment} in the default en.txt
Views
Replies
Total Likes
smacdonald2008 wrote...
You can write a custom email step that uses Java and email templates and then place any variable that you want in the email. Setting variables in a email template involves setting a Java MAP where the key is the name of the variable and the value is the value that is injected into the email template when its sent.
For example...
//Creare a MAP to populate the email template variables
Map myMap =
new
HashMap() ;
String timeStamp =
new
SimpleDateFormat(
"yyyy.MM.dd.HH.mm.ss"
).format(
new
Date());
//Populate the MAP with the values submitted from the HTL front end
myMap.put(
"topic.subject"
,TopicSubject);
myMap.put(
"time"
,timeStamp);
myMap.put(
"host.prefix"
,hostPrefix);
myMap.put(
"forum.url"
,forumUrl);
myMap.put(
"modifiedBy.fullname"
,modifiedByFullname);
myMap.put(
"topic.url"
,topicUrl);
myMap.put(
"post.message"
,message);
//Declare a MessageGateway service
MessageGateway<HtmlEmail> messageGateway;
//Specify the EMail template
String template =
"/etc/notification/email/html/com.day.cq.collab.forum/en.txt"
;
Resource templateRsrc = request.getResourceResolver().getResource(template);
MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.
class
));
HtmlEmail email = mailTemplate.getEmail(StrLookup.mapLookup(myMap), HtmlEmail.
class
);
email.addTo(
"tblue@noserver.com"
);
email.setSubject(
"AEM Email Template"
);
email.setFrom(
"wwhite@noserver.com"
);
//Inject a MessageGateway Service and send the message
messageGateway =
this
.messageGatewayService.getGateway(HtmlEmail.
class
);
messageGateway.send((HtmlEmail) email);
Found the solution :
Use the variable ${item.data.comment} in the default en.txt
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies