How do I dynamically create the Subject in Client Template to populate based on information from the case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2019 06:45 AM
I am trying to dynamically create the subject of a reply email to populate based on information from the case.
I am using the Email [sys_email] table so I'm able to capture the email chain in the reply.
I want the case number as well as the short description from the case to be the subject of the email. The issue I'm having is because the client template isn't using the table used for the case (using sys_email vs sn_hr_core_case_relations). Could someone point me in the right direction as to how I would accomplish this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2019 06:52 AM
Hi,
To set a field as Subject in a Client Template, you can add ${field_name} to your subject field on Client Template.
Similarly you can add ${field_name} to the Body HTML field in the Client Template.
For any other information, please refer to this very well done article:
https://community.servicenow.com/community?id=community_blog&sys_id=df609af8dbbbdb405ed4a851ca961928
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2019 01:32 AM
Any update on this?
If I have answered your question, please mark my response as correct.
Thank you very much
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2019 06:59 AM
You can also create Dynamic Subject line by using Notification email script.
There you can Glide the table used for case and then set the subject accordingly.
Example :
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var gr = new GlideRecord('tbl');
gr.addQuery(...);//if any
gr.query();
//write script to get number and filed name.
email.setSubject(gr.number +" "+gr.field_name);
})(current, template, email, email_action, event);
call the email script in HTML body and empty the subject line of template.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 11:42 AM