Email notification date field

wakespirit
Kilo Guru

Dear all,

In my email body I am refering a date field as below

update on : {current.sys_updated_on}

By doing so the date time format is not according to user setting.

Is there a way directly in email body to format the field according to user setting ?

regarsd

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi Wakesprit,

Try this code, it will work. I just checked in my dev instance and its working fine. You need to write this in the email scripts

var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime(current.sys_created_on);
gdt.setTZ(tz);
var showConvertedDate = gs.getMessage('Created on: {0}', gdt.getDisplayValue());
template.print('<p>' + showConvertedDate + '</p>');

Mark correct and helpful if this works.

View solution in original post

5 REPLIES 5

asifnoor
Kilo Patron

Hi Wakesprit,

Try this code, it will work. I just checked in my dev instance and its working fine. You need to write this in the email scripts

var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime(current.sys_created_on);
gdt.setTZ(tz);
var showConvertedDate = gs.getMessage('Created on: {0}', gdt.getDisplayValue());
template.print('<p>' + showConvertedDate + '</p>');

Mark correct and helpful if this works.