notification message today's date

jack_zheng
Kilo Expert

HI

Is there an easy to insert today's day and date into the body of a notification?   Format will be Tuesday, September 27, 2016

Thanks

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Jack,



"Easy" is a relative term to this crowd. You can do it with a fairly simple mail script. If you're using the v2 mail format, create a notification script.



template.print(gs.nowDateTime());



Save it with a name like 'current_date_and_time'



Call it from within your mail notification like this:



${mail_script:current_date_and_time}



Format will default to the system default. If you want to change format, you can extend the script using the GlideDateTime object and create your own.



Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki


Docs: GlideDateTime


View solution in original post

2 REPLIES 2

Chuck Tomasi
Tera Patron

Hi Jack,



"Easy" is a relative term to this crowd. You can do it with a fairly simple mail script. If you're using the v2 mail format, create a notification script.



template.print(gs.nowDateTime());



Save it with a name like 'current_date_and_time'



Call it from within your mail notification like this:



${mail_script:current_date_and_time}



Format will default to the system default. If you want to change format, you can extend the script using the GlideDateTime object and create your own.



Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki


Docs: GlideDateTime


This does not work for quick messages.  We need a way to simply at today's date to quick messages.