Highlighted

Customizing the default Page Replication email template

Avatar

Avatar

souvik_n

Avatar

souvik_n

souvik_n

30-10-2017

I need to put in a customized email template to be triggered on page deactivations. I am facing a few issues - can someone please help me with the following?

1. Instead of directly modifying the email template at: /etc/notification/email/default/com.day.cq.replication/en.txt, I was wondering whether I can put the modified template in a separate folder under /etc or in /apps and have the Day CQ mail service use that email template for notifications instead of the default one - similar to overlaying for components.

2. I need a variable on the customized email template for the page title but the default template mentioned above doesn't have one. Is there any other way to include the page title in the template?

3. The default mail template has the "host.prefix" variable, but even though I have already defined the value of the variable in com.day.cq.workflow.impl.email.EMailNotificationService and also in com.day.cq.workflow.impl.email.TaskEMailNotificationService the notifications with the default template continue to come in without the "host.prefix" variable being resolved. Please refer to the screenshot below:

1336743_pastedImage_14.png

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

30-10-2017

You can populate any variable in a email template using a Java MAP. See:

//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);

The Java code is explained in this article -- Adobe Experience Manager Help | Creating Adobe Experience Manager HTL Components that send Email mes...

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

30-10-2017

Also - as you can see in that article - you can put the email template where you want in the JCR. You reference it via the Java code:

//Specify the EMail template

             String template ="/etc/notification/email/html/com.day.cq.collab.forum/en.txt";

Highlighted

Avatar

Avatar

souvik_n

Avatar

souvik_n

souvik_n

30-10-2017

@smacdonald2008,

We want to customize the page deactivation notification. How do we pass the java parameter map in that case? We don't want to modify any workflows right now.

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

30-10-2017

You would need to modify the page deactivation workflow. You can use a custom email template and in your Java logic - setup a Map - as shown in the article - with variable values. 

Highlighted

Avatar

Avatar

Ratna_Kumar

MVP

Avatar

Ratna_Kumar

MVP

Ratna_Kumar
MVP

30-10-2017

Hi,

Yes, Scott is correct. You need to modify the page deactivation workflow and use custom email template as described in the below said article.

Adobe Experience Manager Help | Creating Adobe Experience Manager HTL Components that send Email mes...

~Ratna.

Highlighted

Avatar

Avatar

souvik_n

Avatar

souvik_n

souvik_n

30-10-2017

Thanks smacdonald2008 and Ratna,

Sorry, I was not aware that page deactivation also triggered a workflow. I thought it was only the Request to (un)publish and the (Un)Publish Later options that triggers a workflow. Can you give me the exact name/PID for the deactivation workflow?