The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Apply Email Template in Notification

Steven Young
Tera Guru

Hey Again all you Genius's.   I need your help again.

This is kind of a "idea" rather than it being functional (i think).

So here's the deal.

I love ${mail_script:scriptname}   it's awesome.   Very functional, works like a charm.

We have a request item that we have an approval email for.   Then there is a UI action that was create to fire an Event.   We created a 2nd email notification to accept this event to fire the "Resend email"

here's the deal.

The approval email we have a ${mailscript}   at the very top which contains our approval/reject links.   and Information about the request.
Then we have the BODY of the email.   Contains the variables of the request.

Then we have 2 ${mailscript}'s at the bottom with some "for the administrator"   which tells us the ticket number, what email notification send this email, and so forth.

approval.JPG

Here is where the question comes in.   We cant use an HTML template for all the notifications because we add different ${mailscripts}
approval2.JPG

What i'm wanting to know is:
Can we Create a template, that is dynamic like the mail scripts

So in my email notification, i dont have a template "attached" and used.
BUT.   i used something like ${template:templatename}   Because the body of my email wont change.

Is there a way to do something like so.

${mail_script:Approval-Reminder}
${mail_script:Approval-Links}


${template:templatename}

${mail_script:Approval-Additional}


${mail_script:Approval-Administrator}

Where the ${template} will actually pull the HTML data out of the template.
This way i would only have to update it 1 time and it would update in all 3 of my notifications.
I do not want to use the text box.   i want to use HTML.   i dont want to have to use the <mail_script> template.print() for every single line,   Hence using the HTML (WYSIWYG)

Does that make any sense at all?

it would be great for the templates if you attach it as is to the email and it's used with no modifications.   or if you could "call" the template data into the actual email notification like the mailscripts.

1 ACCEPTED SOLUTION

Steven Young
Tera Guru

So i found my answer.   Dot Walk.


Create an email script, say called "template"


Script will be


template.print(email_action.template.message_html);



That will take the reference field of the "template" from the email notification and then pull the HTML field from the template.



Then in the email notification you can do a ${mail_script:template}   and that is all that is needed.



So now my email Notification html box looks like so:
Capture1.JPG




It will translate into this


Capture2.JPG


View solution in original post

34 REPLIES 34

Steven Young
Tera Guru

I'm playing with the idea of creating a template.   attaching it to the email notification, Then creating a email client script doing a glide record script referencing the template attached, and pulling the HTML field?  



Thoughts?


Steven Young
Tera Guru

So i found my answer.   Dot Walk.


Create an email script, say called "template"


Script will be


template.print(email_action.template.message_html);



That will take the reference field of the "template" from the email notification and then pull the HTML field from the template.



Then in the email notification you can do a ${mail_script:template}   and that is all that is needed.



So now my email Notification html box looks like so:
Capture1.JPG




It will translate into this


Capture2.JPG


I'm going to resurrect this thread and ask a few more questions.



The proposed solution only grabs the template that is being used in the template field of the notification. This limits the notification to use one template per notification.



It is a bit indirect as we are going from (tables) Email Notification to Email Script to Email Template. It works if you only have one template to given the single reference field.



The idea of ${template:template_name} hypothetically could give you access to any of the templates and put together multiple templates in one notification which would be super efficient.



Can we put together a single mail script to call any template any number of times in an email notification?



The quick (and quite dirty) way would be to have a single mail script for each template... but that sounds as ridiculous to also maintain...


I second these comments. I'm really looking for something that can add any mail template dynamically to a notification based on any given conditions.