
- 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 12:58 AM
Can you use 'sys_created_on' instead of the label created.
--Jogen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 01:02 AM
Notification has defined on the user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 01:08 AM
Please follow the thread it can be helpful.
Client Script Date/Time Functions
code:
var ajax = new GlideAjax('ClientDateTimeUtils');
ajax.addParam('sysparm_name','getNowDateTime');
ajax.getXML(doSomething);
function doSomething(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2015 01:31 AM
Hi Naveen,
Running something similar to your code in Background scripts gives me the following output
var created = new GlideDateTime();
gs.print("created "+ created);
*** Script: created 2015-09-03 08:23:41
Timestamp is in GMT
Have you checked to see if adding ${mail_script:Test} to the Subject line works as you expect? Perhaps with a very simple script.
Best Regards
Tony