
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-08-2021 06:06 PM
The calculation of SLA is dependent on various SLA Definition settings when you configure. One of them is "Timezone Source". Here I am taking a scenario that can be an use case where the need of Timezone source is very important.
Scenario#1
A Group consisting of Members from USA & India. An Incident has been assigned to this group. Ideally the SLA should calculate based on the Assignee's timezone because the resolution needs to be done by the Assignee and some members working in EST hours & some are working in IST hours. Going with the default Timezone source may not work in this scenario. You need to create a custom source for it.
Here is how you can create a custom timezone source
1. Go to the Dictionary entry of "Timezone source"
2. Add a choice as shown below
3. Go to the OOTB Script include called "SLATimezone" (Note: You can modify this script even though it is OOTB as modification of this script include is allowed as per comments from Servicenow)
Now, add the code like this
SLATimezone.source = function(source, /* task_sla */ gr, taskGr) {
if (!taskGr || taskGr.sys_id.nil())
taskGr = gr.task.getRefRecord();
switch(source) {
// The caller's time zone
case 'task.caller_id.time_zone':
return (SLATimezone._getCaller(taskGr)).time_zone;
// The SLA definition's time zone
case 'sla.timezone':
return gr.sla.timezone;
// The CI's location's time zone
case 'task.cmdb_ci.location.time_zone':
return taskGr.cmdb_ci.location.time_zone;
// The task's location's time zone
case 'task.location.time_zone':
return taskGr.location.time_zone;
// The caller's location's time zone (old and new property values)
case 'task.caller_id.location.u_time_zone':
case 'task.caller_id.location.time_zone':
return (SLATimezone._getCaller(taskGr)).location.time_zone;
case 'task.assigned_to.time_zone':
return taskGr.assigned_to.time_zone;
// (add your own ideas here)
default:
return null;
}
};
4. You are all set to use this source now.
Let me know if any further information is needed.
Thanks,
Narsing
- 3,713 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi - nice work.
We did something similar but simply amended the default returned value to be the custom timezone we required (assignment groups' schedule's timezone). This meant we always had a timezone rather than ? and this suited the business requirement "if in doubt, the timezone of the team dealing with the task is fine".
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi
Speaking about Scenario#1, As the SLA should calculate based on Assignee's timezone and some Assignee's are working in EST hours & some are working in IST hours. So we created a custom Timezone source as "Assignee's Time Zone".
My Question here is, What will be the Schedule for the same SLA? Because, if we provide 08:00-06:30 M-F on a floating TimeZone, it mismatches the working hours from different countries, As Assignee from India will work in a different schedule(Eg. 10:00-07:30 M-F) & Assignee from Canada will work in a different schedule(Eg. 08:00-06:30 M-F).
What will be the Schedule source & Schedule for this SLA?
Could you please share your idea here as we are in a need for a similar kind of requirement.
Thanks,
Mukhesh
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Narsing1 ,
I have also configure the same for custom timezone source but it is not working please help me this -
I have create a new field on task table added to form - "SLA timezone" it is a reference field and have user also
and also I have created Choice option in TimeZone Source field and selected that on SLA definition
and then I have edited the OOB script include "SLA TimeZone"
after configure all of this then I check by creating new case, it is not working and SLA taking US/Easten timezone but the field user has Europe/Amsterdam Timezone
please help me with this and let me know is there anything I have done wrong.