Date Time Fields in Email notification scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2013 06:13 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 12:42 PM
In case you are trying to utilize this outside of the SLA's - you can do something like the following inside of your mail script to force the desired timezone (note the use of Java packages, and reference this wiki link😞
...
while(gr.next())
{
var gdt = new GlideDateTime(gr.planned_end_time);
var timezone = Packages.java.util.TimeZone.getTimeZone('US/Pacific');
gdt.setTZ(timezone);
template.print('EXPECTED RESPONSE TIME : 'gdt.getDisplayValue());
}
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 01:38 PM
But does it output it in the correct format with the 'BST' time zone signifier on the end?
I think the issue is that if you use the ${current.sys_created_on} or whatever format, then it puts in the time zone signifier automatically, but if you do it programmatically, then it probably takes the date format of your profile, which doesn't have the time zone signifier on it.
Will your code actually include GMT or BST or PDT and so on?