
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 12:47 AM
Hi,
I am trying to populate the current date in the email notification by using an email script.
Here is my email script: Test
var created = new GlideDateTime();
gs.log("created"+ created);
template.print(created);
My notification subject is:
Your Time Card Submission is Late for the Reporting Period of ${mail_script:Test}
But this is not working.
Thanks,
Naveen
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:45 AM
You can set dynamic subject through script using email object
http://wiki.servicenow.com/?title=Scripting_for_Email_Notifications#Overriding_Email_Fields

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:54 AM
Yes, but only in the body. not in the subject
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 09:36 AM
Hi!
Is there a way to modify your script to show the time in the system timzone for that user?
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:45 AM
You can set dynamic subject through script using email object
http://wiki.servicenow.com/?title=Scripting_for_Email_Notifications#Overriding_Email_Fields

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 03:12 AM
It is working .
I have done this using email.setSubject.
var created = new GlideDateTime();
gs.print("created"+ created);
email.setSubject("Your Time Card Submission is Late for the reporting period of "+ created);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:25 AM
Hi Naveen,
try this:
var nowdt = new Packages.com.glide.glideobject.GlideDateTime();
nowdt.setDisplayValue(gs.nowDateTime());
var cur_date = nowdt.getNumericValue();
cur_date will give you current date.