AEM 6.2 Classic : Capture comments in default email template used by workflow

cquser1 30-08-2018

Hi All,

The use case for us is same as mentioned in Capturing comments in default email template used by workflow in 6.2 .

Tried the solution mentioned in the above forum post, but no luck.

All the participant steps in our case is "Dynamic Participant Step". Tried multiple things in "/etc/workflow/notification/email/default/en.txt/", based on Configuring Email Notification  but no luck.

Any thoughts/pointers/reference code on this will be really helpful.

Answers (17)

Answers (17)

cquser1 02-09-2018

Hi Arun,

Considering the overall factors, looks like as you mentioned, we have to go ahead with "Participant step" instead of "Dynamic Participant step".

Tried doing it via custom process step, but realized that the issue will occur if we do a "stepback" from any of the step. That will again create issues.

One thing we noticed is just after Flow Start, if we have "Participant Step" and while initiating wf from page, if we provide comments, then that that doesn't get populated via ${}. It is stored under "startComment" property under /etc/workflow/instances/server0/2018-09-02/instance_1/data/metaData. But we need ${} in that step, as it will be used if we do a "stepback" at any point of time in the workflow.

So, basically - the very first time workflow is triggered(i.e, in the above mentioned scenario), we will have an issue. At rest of the times, it will work fine, along with the "aborting/completion" limitation you mentioned.

In case, you have some pointers/solution for the "very first time workflow is triggered" thing, please do let us know.

cquser1 01-09-2018

Hi Arun,

We are using "Dynamic Participant Step" for all the participant activities. Is it something like because of this, we are not able to use



${} does works for node transitions emails when user get notification to act on step but not when email triggered for Completion/Abort jobs.

Screen Shot 2018-09-02 at 1.49.46 AM.png

Screen Shot 2018-09-02 at 1.47.33 AM.png

Screen Shot 2018-09-02 at 1.43.30 AM.png

Screen Shot 2018-09-02 at 1.43.43 AM.png

cquser1 31-08-2018

Hi Scott,

Since via OOTB template we are not able to extract comments provided in the previous step, we are trying to implement something very similar[ALONG WITH COMMENTS] via custom step.

However, the challenge we are facing is not being able to get the user details of the next step to which the mail[which will have comments/time etc of the previous participant step] should go to.

Also, in all our participant steps, across the workflow [we are using dynamic participant step]. Here, we are giving the group name in "Arguments" section and we have an ecma script, as provided [

function getParticipant() {

    return args[0];


] in "Participant Chooser", based on which it is assigned to the corresponding group.

cquser1 31-08-2018

Hi All,

We are trying to implement a custom process step wherein it will send almost similar details sent by OOTB template [/etc/workflow/notification/email/default] along with the comment provided by the previous participant step.

Able to make some progress here. For example : Once step1 is completed, mail should be triggered to user2 in step2. Able to capture comments/task end date etc of step 1. Am not able to find any property in the workflow, wherein I get user2 details(who is part of  step2), to whom the mail should be sent.

Any thoughts/pointers on this will be really helpful.

cquser1 31-08-2018

Hi Endoriel,

Thank you for your reply.

Tried getting the comments by adding a new variable[with various options i.e, ${}\n \, ${}\n \  etc] in the existing OOTB template in the path /etc/workflow/notification/email/default as mentioned in Configuring Email Notification  .

Not sure if I am missing something here. Tried multiple times with various options.

The other variables in the OOTB template gets populated correctly in the mail received.

Below is the OOTB content[/etc/workflow/notification/email/default]


subject=Workflow notification: ${event.EventType}

header=-------------------------------------------------------------------------------------\n \

Time: ${event.TimeStamp}\n \

Step: ${item.node.title}\n \

User: ${} (${})\n \

Workflow: ${model.title}\n \


message=Content: ${host.prefix}${}\n

footer=\n \

-------------------------------------------------------------------------------------\n \

View the overview in your ${host.prefix}/inbox\n \

-------------------------------------------------------------------------------------\n \

This is an automatically generated message. Please do not reply.

Endoriel 31-08-2018

It should work with ${} since from code doing workflow.getWorkItems().get(0).getMetaDataMap().get("comment") would return the comment and in the template context "" is just workItem.getMetaDataMap() so I'm not sure. I will test it later. Are you sure you are editing the correct template? Can you add successfully some of the other available variables?

If you can't get it to work I would suggest implementing your own custom version of the EMailNotificationService which is just an osgi event handler for "com/day/cq/workflow/event"