How to show user's local time in Email Notification

poojabhosale
Kilo Contributor

Dear All,

Can someone help me to show user's local time in Email notification.

If user sends an email or update any work notes (eg. for Change Record ) in Service Now then mail triggers.

How can we change that time so that user can see their local time in that updated record.

If user is from Zurich region then he should be able to see local time of Zurich region only no matter if other user updates the record from India.

I have used 'glide.email.append.timezone' ( " Email Properties - ServiceNow Wiki   " ) property, but it just appends the system time zone to date and date/time values in outbound emails. For example, 2010-07-02 04:01:14 PST.

Also I have used 'com.snc.on_call_rotation.reminders.showtz' this property, but its not showing what I required.

Please help me to get this done.

Best Regards,

Pooja

3 REPLIES 3

ccajohnson
Kilo Sage

Notifications are designed for multiple recipients. Unless this particular notification is only to one individual, then it is not possible to parse every recipient out of the email log record to send in different time zones. If the notification is only to one individual, then you should be able to create multiple notifications based upon each time zone you will be sending to. Then you would have to create a method of converting the display value shown in the email to show the proper time for each date/time field per time zone as well. Doing all of this is quite time consuming and you need to ask if the amount of effort justifies the need.


poojabhosale
Kilo Contributor

Thanks for your support.



But suppose I need to show user's timezone (if user is in 'Assigned to' field in Change Request record ), so is it possible to show his timezone in the Email Notification ?



Please advice.



--


Best Regards,


Pooja


If you just want to show what the timezone of the Assigned to is, you should be able to pull that information by dot-walking: ${assigned_to.time_zone}



If you need to show a date/time field in the time zone of the Assigned to user, then you need to create a Notification Email Script that converts the stored value of the date/time field to use the time zone of the Assigned to user. Since ServiceNow stores all date/time fields in GMT, you have a starting point, all you then need to do is convert it to the time zone of the user in the Assigned to field. Since ServiceNow uses the java.text.SimpleDateFormat class to display date/time fields for users when they view a record, you should be able to use the method to change the format from GMT to whatever time zone the Assigned to uses.



To see what formats to use, see the following page:


Class java.text.SimpleDateFormat



For a sample of how to do this in ServiceNow, see the following Community article:


How to get date in script