Date Time Fields in Email notification scripts.

MVRakesh
Mega Contributor

Hi,

we are using a mail script notification to send date time field values like 'Date Opened' & task SLA - Planned End Date time.

Date opened field is showing proper time of ticket creation in PDT time zone as default.
when it comes to Planned End Time it is not showing proper time.It is showing around 8 hours difference.

SLA Business hours is 8 - 17 hours CST
Response time is 1 hour.

CREATION DATE: 2013-12-02 04:02:10 PDT
EXPECTED RESPONSE TIME : 2013-12-02 15:00:00 PDT which is showing wrong.

I am using below script in notifications on Incident table.

var gr= new GlideRecord('task_sla');
gr.addQuery('task', current.sys_id);
gr.addNullQuery('end_time');
gr.addQuery('stage','IN','in_progress,paused');
gr.query();
while(gr.next())
{
template.print('EXPECTED RESPONSE TIME : '+gr.planned_end_time);
}


Thanks in advance.

6 REPLIES 6

Dan Tolgyesi1
Tera Expert

Hi,

Not sure if this will work but you could try using.

template.print('EXPECTED RESPONSE TIME : '+gr.planned_end_time.getDisplayValue());


MVRakesh
Mega Contributor

Thank you for the reply.


As far I Knew , if we use the getDisplayValue() it shows the time zone of the user(Update that caused to trigger the event).

I require it to be unique for all, that is in PDT Timezone.


There is a Property that needs to be set to Display the Time Zone (glide.email.append.timezone)

http://wiki.servicenow.com/index.php?title=Using_Time_Zones#Time_Zones_in_Email_Notifications


robbika
Giga Contributor

Did you solve this?



As far as I can see, if you use Javascript to print out a date time it will always print it in UTC with no time zone identifier.



I'd be interested if you found a solution.