Display Current Date on a Scheduled Report Using HTML Source Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 01:49 PM
I want to insert the current or previous date either in the subject or body of a scheduled report. How would I do that using the HTML Source Code? I am an end-user not a developer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 03:31 PM
Hi,
This can be achieved using mail script within "report_body" field.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 11:25 AM
Thanks, Saurabh for responding to my question. Unfortunately I do not know what script to use or where to place it. I only have access to the source code in the Introductory Message. What script should I use and how should I write if I can use the source code? Thanks again. Your time is much appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 04:46 PM
Since you mention you're not a developer, I'm going to add a little more detail for Saurabh's answer.
There should be record in the 'Scheduled Email Reports' table for your report. In that record, there's a field 'Introductory Message'. You can add mail script to that field using this syntax ${mail_script:<script_name>}. To generate a basic timestamp in system time and system time format the script would be:
var jsTime = new GlideDateTime();
template.print(jsTime);
To create a new mail script, navigate to 'Notification Email Scripts', and click 'New'. Give it a name, which you'll use above in <script_name>, delete all the code that defaults in (your script isn't going to be that complex) and paste in the above.
Add ${mail_script:<script_name>} in the Introductory Message field for Scheduled Report, and you're good.
This will give you the system time in the system format (i.e, '2022-11-22 16:44:45') in the default font, but you can wrap in some CSS to pretty it up. To display it in a different format, check out the docs for GlideDateTime to see how you can change up the script to return different formats.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 11:39 AM
Thanks, Ron for responding to my question. I tried using the scripts mentioned in the source code unfortunately they didn't work. I received an error message "Email script render error: email script does not exist" I am not if I have written it correctly or if I do not have the level of permission to add or modify the source code. Also, I do not see Notification Email Scripts in my view therefore I am assuming I do not have the level of permission to use the Notification Email Scripts. Thanks for your help and time. Much appreciate it.