
- 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:11 AM
I have done that, but it is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:20 AM
Subject does not supports the mail script i hope. Because i applied the same thing in the body, it does work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:22 AM
Can you post your whole mail script from the email.
Perhaps something else is falling over.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:33 AM
Hi Daryll,
This is a simple mail script where i need to populate the current date in my notification subject.
Test
- var created = new GlideDateTime();
- gs.log("created"+ created);
- template.print(created);
Notification Subject: Your Time Card Submission is Late for the Reporting Period of ${mail_script:Test}
Message HTML:
Time card submission is late for ${name}.Time cards are due by 9 pm on Sunday, please submit your time card via this link
${mail_script:Test}
Once this notification runs, it is going to populate the the below content.
Subject:
Your Time Card Submission is Late for the Reporting Period of ${mail_script:Test}
Body:
2015-09-03 09:17:57
Time card submission is late for Admin.Time cards are due by 9pm on Sunday, please submit your time card via this link.
I hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 02:40 AM
The only thing I would question is "${mail_script:Test}" are you sure this is returning what you expect?