Notifications

56 views

Description

When a reply to an email message is made using the email client, the OOB "insert_original_email_message" Email Script prints PST timezone instead of user timezone

Even though the “glide.email.append.timezone” value is set to true and that the system properties has the correct timezone as do the user records.

Steps to reproduce:

  1. Enable the glide.ui16.emailStreamResponseActions system property.
  2. Open any incident and check for the “email sent” in the activity formatter, In the email details reply, reply all, forward button are visible.
  3. On clicking the reply button, the email client will open and in that one can observer the “On 2020-02-27 05:47:19 PST, 'system' wrote:
  4. Here if the system property has different system time zone eg: GMT, though the system returns the PST in email client.

Cause

This reply form is controlled by “reply-sent” email client template which in turn calls the OOB email script “insert_original_email_message”. The script uses toLocaleString() to get this default PST timezone conversion, because date is a built-in JS object, toLocaleString() uses browser's default locale. If browser's locale is not defined, it uses system locale.

ReferenceJavaScript Date objects

Resolution

Update the email script to use GlideDateTime to honour system property/user timezone preferences.

Change the line in the email script “insert_original_email_message” code from 

template.print("On " + cdate.toLocaleString() + ", '" + uname + "' wrote:\n\n");

To

var gdt = new GlideDateTime(cdate);

var curr_date = gdt.getDisplayValue();

template.print("On " + curr_date + ", '" + uname + "' wrote:\n\n");

Additional Information

Please ensure all testing is done on sub-production instances before implemented on a production instance

Article Information

Last Updated:2020-03-24 04:48:00
Published:2020-03-19