AEM 6.2 Classic : Capture comments in default email template used by workflow | Community
Skip to main content
cquser1
Level 7
August 31, 2018
Solved

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

  • August 31, 2018
  • 18 replies
  • 4445 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

Did you try below,  mentioned at Configuring Email Notification

Comment: ${item.data.comment}\n \

18 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
August 31, 2018

Hi,

Did you try below,  mentioned at Configuring Email Notification

Comment: ${item.data.comment}\n \

Arun Patidar
cquser1
cquser1Author
Level 7
August 31, 2018

Hi Arun,

Yes, I did try that in the OOTB /etc/workflow/notification/email/default/en.txt file. But that doesn't work.

Endoriel
Level 2
August 31, 2018

Hi,

Can you try ${item.node.data.comment} ?

If not, I can try to suggest some other options.

cquser1
cquser1Author
Level 7
August 31, 2018

Hi Endoriel,

Tried using the below.

TEST: ${item.node.data.comment}\n \

But no luck.

Any thoughts here would be helpful.

Endoriel
Level 2
August 31, 2018

It should work with ${item.data.comment} since from code doing workflow.getWorkItems().get(0).getMetaDataMap().get("comment") would return the comment and in the template context "item.data" 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"

smacdonald2008
Level 10
August 31, 2018

In that other thread - the user said the solution was  --

Use the variable ${item.data.comment} in the default en.txt

cquser1
cquser1Author
Level 7
August 31, 2018

Hi Endoriel,

Thank you for your reply.

Tried getting the comments by adding a new variable[with various options i.e, ${item.node.data.comment}\n \, ${item.data.comment}\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: ${participant.name} (${participant.id})\n \

Workflow: ${model.title}\n \

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

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

footer=\n \

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

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

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

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

cquser1
cquser1Author
Level 7
August 31, 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.

smacdonald2008
Level 10
August 31, 2018

Your 1st step is a user part step and you want to send an email to this user?

smacdonald2008
Level 10
August 31, 2018

Ratna and I are working on this use case BTW, it will make a good article/example.