Expand my Community achievements bar.

SOLVED

Email Notification template

Avatar

Level 2

Hi, 

When I am trying to send the email notification template in a workflow, it always points towards 

/libs/settings/workflow/notification/email/default/en.txt  template but it is not a good practice to make any changes in libs if I have to modify the template. 

Could anyone help me know is there any other way that how to customize the new email template and redirect workflow towards it ? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You are right, in cloud setup EMailNotificationService implementation has changed a bit. So overlay could work in AEM as a Cloud Service, but for on-prem version 6.5 and 6.4 it will not, due to the reason I have described in my previews message.

View solution in original post

9 Replies

Avatar

Level 4

You can overlay it under /apps and workflow would automatically pick anything under /apps over /libs (If cloud impl ) . E.g. for asset expiry notification we overlayed /libs/settings/dam/notification/email/default/com.adobe.cq.dam.asset.expiry.prior/en.txt to 

/apps/settings/dam/notification/email/default/com.adobe.cq.dam.asset.expiry.prior/en.txt and added our own text/html.

Avatar

Community Advisor

Hi @khasinaparveen,

According to the official documentation:

Template for email workflow notification can be changed only under /libs. Overlay of /libs/settings/workflow/notification/email/default/en.txt will not work because com.day.cq.workflow.impl.email.EMailNotificationService which is responsible to sent an email has hardcoded path to /libs/settings/workflow/notification/email/default.

Alternatively you can try to extend EMailNotificationService and change location of template to use your custom location.

Avatar

Level 4

Okay , we did use it recently and it worked for us (on cloud) , you may want to check that.

Avatar

Correct answer by
Community Advisor

You are right, in cloud setup EMailNotificationService implementation has changed a bit. So overlay could work in AEM as a Cloud Service, but for on-prem version 6.5 and 6.4 it will not, due to the reason I have described in my previews message.

Avatar

Level 2

Yes Exactly. In AEM as a cloud it worked. But, for 6.5 no overlay was working. Had to edit the template under /libs.

Thank you.

Avatar

Level 4

khasinaparveen which version of AEM are you using. If cloud , you can overlay the the default template and if on 6.5 you need to write your own service as discussed above.

Avatar

Level 2

In AEM 6.5.20 the class com.day.cq.workflow.impl.email.EMailNotificationService tries to find the email templates first here:

String templateLocation = "/etc/workflow/notification/email/default";

 If this location does not exist, it takes '/libs/settings/workflow/notification/email/default' as default path.

 

So for overlaying the email templates to create custom emails, you can copy '/libs/settings/workflow/notification/email/default' to '/etc/workflow/notification/email/default' and adjust it there.
No service restarts required.

In AEM 6.5.20 this worked. For lower AEM versions please try on your own.

Avatar

Level 2

"No service restarts required." is not correct. The folders are read during service activation. So the service/instance needs a restart.
Enabling a debug log for com.day.cq.workflow.impl.email.EMailNotificationService shows which folder is used during service activation.