- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 11:38 AM
Hello,
I was wondering if there is any possibility to configure an email template to contains only a specific header and footer, and get the body from the email notification form ?
So my email template will have a fixed header and footer and variable body which is the email notification content.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 01:37 PM
So templates aren't as nuanced as you're hoping. A template will build the whole body, and doesn't distinguish between body headers, main body, and footers.
Also, it sounds like you want each notification to retain its currently defined body, which is like saying "I want to always use just a part of a template".
Only thing I can think of is to use Kalai's approach, but it requires always remembering to put the mail scripts in your notification body. It'll look like this...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 02:27 PM
To get "variable body which is the email notification content" in your email template, use email_action, which is GlideRecord object for the email notification (sysevent_email_action). So your template would look like
Email Template Message Field:
Header contents
<mail_script>
template.print(email_action.message_text); // for Message content from Email Notification
template.print(email_action.message_html); // for Messaage HTML content from Email Notification
</mail_script>
Footer contents
and specify this template in your email notification.
EDIT: as Reda pointed out below, this won't work because any contents in "Message HTML" or "Message text" will override the template. Please see the reply below for more details.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 12:28 AM
It doesn't seem to work because the email notification message will override the message from the template form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 07:57 AM
Pardon me! My rusty memory overlooked the fact that any contents in "Message HTML" or "Message text" will override the template. One kludge, if you're not using SMS, is to put the email body (HTML is OK) in the "SMS alternate" field, which surprisingly has a max length of 4,000, in Email Notification (not in template). Then your Email Template would look like
Email Template Message Field:
YOUR HEADER
<mail_script>
template.print(email_action.sms_alternate);
</mail_script>YOUR FOOTER
Alternatively, you could add a custom field in Email Notification to hold the email body. Do I like this solution? No, it's a hack at best, but may do the job if you want to separate the header/footer from the body. Or you could go with the solution suggested by Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 08:01 AM
Thank you John Chun, I really like your solution but I think I will go with Robert and Kalaiarasan solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 06:57 AM
Still shocked at how much I don't know after all these years.