- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 11:21 PM
hi everyone i need help to configure the subject in email client templates
here in subject i want incident record's related record short description it is possible to configure ? if yes can anyone help me how to do it
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 12:01 AM
Hi @lalithkumar , For this, we will have to script and query the related records, so we need mail script. But you can't add a mailscript to the subject, but you can call a mailscript in the body and set the subject. Try this -
var gr = new GlideRecord("change_task");
gr.addQuery("change_request", current.sys_id);
gr.query();
if (gr.next()) {
var subject = gr.number + ' - ' + gr.short_description;
}
email.setSubject(subject);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 12:33 AM
Hi @lalithkumar yes. Unfortunately, the email client template does not have access to the 'email' object. Sorry, I missed that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 12:01 AM
Hi @lalithkumar , For this, we will have to script and query the related records, so we need mail script. But you can't add a mailscript to the subject, but you can call a mailscript in the body and set the subject. Try this -
var gr = new GlideRecord("change_task");
gr.addQuery("change_request", current.sys_id);
gr.query();
if (gr.next()) {
var subject = gr.number + ' - ' + gr.short_description;
}
email.setSubject(subject);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 12:16 AM
i tried like this but its not working .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 12:33 AM
Hi @lalithkumar yes. Unfortunately, the email client template does not have access to the 'email' object. Sorry, I missed that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 11:33 PM
Hi @lalithkumar
This will work here for Email Client Template ${number} - ${short_description}
Mark this as correct answer if it works for you
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************