- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 11:08 PM
We have a couple of email notifications that need to use email scripts to populate the body of the email, and the email bodies include the opened and closed times of tickets. However, when we use the email scripts to show these variables, the time zone is incorrect. For example, if a request is opened at 3:05pm, the email will say it was opened 10 hours earlier at 5:05am. The time is displayed correctly everywhere else in our ServiceNow instance. If we don't use an email script to show the variables and instead select the field values in the notification editor, the correct time zone is shown. Unfortunately, not using an email script isn't an option in this scenario.
The email script code we're using:
Time displayed when we use an email script:
How the field value looks when it's populated in the notification text editor:
Time displayed when we select the field values in the notification text editor:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 11:39 PM
Hi @Abbottronix ,
Could you please try with below in notification email script:
current.opened_at.getDisplayValue()
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 11:39 PM
Hi @Abbottronix ,
Could you please try with below in notification email script:
current.opened_at.getDisplayValue()
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 01:37 AM
Hi @Abbottronix
The values are stored in GMT. But when it is displayed on form/list it displays in user timezone. When you do current.opened_at, you are getting GMT time. To get the actual display value, use the below line of code :
current.opened_at.getDisplayValue()
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.