Email script for Subject , sender and receiver details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 12:41 PM
Email script for Subject , sender and receiver details :
Kindly help me to build email script to get email Icon , Subject/short description of ticket , Sender and receiver details as per below screenshot. for one of the notification they want to include this.
other than this there are few more data required like priority , state , assigned to ... i found this email script.
But i need same like above screenshot functionality .
Kindly help me code on same.
i tried below email script like below but not fetched details.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var i18nSubject = gs.getMessage('Subject: {0}', '${short_description}');
var i18nFrom = gs.getMessage('From: {0}', '${assigned_to}');
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 06:53 AM
HI,
This is activity sections and is shown automatically. You want to built this structure in your mail script?
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 09:15 AM
-You want to built this structure in your mail script?
Yes as per requirement we need to do this in "mail script"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2020 07:12 AM
Kindly help me to build email script to get email Icon , Subject/short description of ticket , Sender and receiver details as per below screenshot. for one of the notification they want to include this.
- Email Script: Hope, you are calling this script from the Notification; by putting below line in the Notification > Message HTML editor.
${mail_script:script name}
- Email Icon: This is not possible, or not sure what the ask here.
- Subject: To make subject as short description, see the code below.
- Sender: See the below code, if your sender info is present somewhere on record / system, you can fetch it first in below code and put instead of the hard-coded email string.
- Receiver: For Receiver address details; you need to modify the Notification's [Who Will Receive tab]. You should be able to find the receiver email from your record, or just hard-code in the first field of this tab.
other than this there are few more data required like priority , state , assigned to ... i found this email script.
- Other Info: Most of these information are directly accessible from your record and can be put directly to the notification body using the right side field's tree.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Your code starts
//Considering that this email is triggered for the Incident record, and so current is a incident record
email.setSubject(current.short_description.toString());
email.setFrom('dev27348@servicenowdevelopers.com');
// Your code ends
})(current, template, email, email_action, event);
..All the best
Chirag A
Servicenow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2020 07:16 AM
If you just have an issue with your existing code; then let me correct that one...
var i18nSubject = gs.getMessage('Subject: {0}', '${short_description}');
//above should be ....
var i18nSubject = gs.getMessage('Subject: {0}', current.short_description.toString());
Chirag A
Servicenow Developer