- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 11:30 AM
I have an email notification that calls several mail scripts.
I am looking to add the current date to the subject of the email -- so "Notification for - Current Date"
It seems like there should be a way to do this but I can't figure it out. Has anyone done this?
Thanks,
Sandy
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:35 PM
Can you try below then,
(function runMailScript(current, template, email, email_action, event) {
var gDateTime=new GlideDateTime();
var gDate = new GlideDateTime().getDate();
var gFormat=gDate.getByFormat('EEEE, MMMM dd');
var gt = (new GlideDateTime()).getLocalTime().getByFormat('hh:mm a');
//gs.print(gt);
//var TFormat=gt.getByFormat('HH:mm');
var FinalFormat=gFormat+' '+gt;
//gs.print(FinalFormat);
template.print(FinalFormat);
})(current, template, email, email_action, event);
Output as desired.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:02 PM
Actually each time I run this, everything is perfect except the time keeps saying 20:00..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:20 PM
Thank you. That adds PM at the end, but each time I run it, the time always says 20:00 rather than update to the current time. I am not sure why..
I really appreciate your help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:35 PM
Can you try below then,
(function runMailScript(current, template, email, email_action, event) {
var gDateTime=new GlideDateTime();
var gDate = new GlideDateTime().getDate();
var gFormat=gDate.getByFormat('EEEE, MMMM dd');
var gt = (new GlideDateTime()).getLocalTime().getByFormat('hh:mm a');
//gs.print(gt);
//var TFormat=gt.getByFormat('HH:mm');
var FinalFormat=gFormat+' '+gt;
//gs.print(FinalFormat);
template.print(FinalFormat);
})(current, template, email, email_action, event);
Output as desired.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:37 PM
This is great - I can't thank you enough!