Email Notification cannot get the User Time Zone

Mohamed Faizel
Giga Expert

Hi,

When we receive the email notifications from service now including work notes in the body, it has shown the instance time zone and time and it does not fetch the users time zone with latest updated time in email.

Can any one please help on this?

22 REPLIES 22

Does this work on Eureka?   I'm trying to get email notifications to display a specific timezone, which is different from the system timezone.   I would like this email to show the same timezone for all users who will receive it.



Thanks


I've not tried this with Eureka (I'm currently running Dublin). This will currently show the timezone for the user that creates the email notification.



<mail_script>


    var user = gs.getUser();


    var timeZone = String(user.getTZ()); // <---- You can change this line to get the user you wish to use the time zone for or you can use a hard coded time zone.e.g: 'US/Eastern'


    TimeUtils.changeTimeZone(current, 'work_start', timeZone);


    template.print('First Task Start Date: ' + current.work_start.getDisplayValue());


</mail_script>


This doesn't work.   The email came through with that line being blank.   I tried some variations of that same code and it is still showing the system time.


If you use current.start_date.getDisplayValue() // It can give what the date appers on the form.


The problem here is that the form will show the system time, but I want it to show one specific timezone.   We have not yet implemented Self Service, so all of our users have the system time set for their accounts.   I would like to send an email out for an event and show the timezone of the event.   The email will be going to people across the globe.