- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 10:30 AM
I want to configure two SLAs for target response time (The time from when an incident was created and is first responded to by a tech.)
One for when the incident is created during business hours (8-5M/F) and another for outside of business hours.
For example:
SLA1 - Mon - Fri, 8AM - 5 PM: Respond within 1 hour
SLA2 - Mon - Fri 5PM 12AM/12AM- 8AM, Weekends, Holidays: Respond within 2 hours
The problem I'm trying to solve is what happens when an incident is created at 7AM? Based on my understanding of schedules that SLA would stop running in 1 hour at 8AM and resume the second hour at 5PM and won't report a breach of SLA until 6PM, which is obviously not what we want. We would want that SLA to breach at 9AM
How do you guys handle this kind of situation?
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 03:52 PM
Hey Joshua,
From what I see in your requirements you want to be able to trigger a separate SLA Definition based off of what time in the day the incident record was created. Unfortunately it's not as simple as altering your 'Start Conditions' filters. You would need to perform some scripting to create something called a custom SLA condition rule. Here are some docs:
Create a custom SLA condition rule
I would create a new SLA Condition Class script include and make changes to the attach() function (this is the function that 'starts' the SLA if the conditions are true). Something like this:
attach: function() {
return (this._conditionMatches(this.sla.start_condition) && this.isWithinBusinessHours());
},
isWithinBusinessHours() {
How to determine if a given date is within a given schedule
(I'm not gonna do all of the work)
},
I've attached (inside the function call) a potential article that can help you figure out how to implement the isWithinBusinessHours.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 12:37 PM
The timer will tick during whatever hours are defined on the schedule associated with the SLA definition. You don't want two different standards on the same SLA definition, you want two SLA Definitions, each associated with a unique Schedule. One for a schedule defining business hours, the other for a schedule defining non-business hours.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 03:05 PM
Right. That's done. But how do I make it so that the correct SLA triggers based on the time of day that the incident was created.
If I do it this way I'll get two SLAs for the same incident tracking the same thing... just on different schedules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 03:52 PM
Hey Joshua,
From what I see in your requirements you want to be able to trigger a separate SLA Definition based off of what time in the day the incident record was created. Unfortunately it's not as simple as altering your 'Start Conditions' filters. You would need to perform some scripting to create something called a custom SLA condition rule. Here are some docs:
Create a custom SLA condition rule
I would create a new SLA Condition Class script include and make changes to the attach() function (this is the function that 'starts' the SLA if the conditions are true). Something like this:
attach: function() {
return (this._conditionMatches(this.sla.start_condition) && this.isWithinBusinessHours());
},
isWithinBusinessHours() {
How to determine if a given date is within a given schedule
(I'm not gonna do all of the work)
},
I've attached (inside the function call) a potential article that can help you figure out how to implement the isWithinBusinessHours.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2017 09:28 PM
Hey John,
Can you help me out a bit more? I'm a bit new to scripting and I'm afraid I just can't quite get my head around the idea of extending a SLA condition class with a separate script include. So instead what I've done is cloned the default "SLAConditionBase", but now I'm stuck on how to actually edit it to include my custom SLA condition class.
Here's the function I have written (taskID should have been taskGlideRecord, to make it clear that I'm expecting a GlideRecord object as a parameter)
function taskCreatedWithinSchedule(taskID,scheduleName){
var taskCreated = new GlideDateTime(taskID.sys_created_on);
var scheduleRecord = new GlideRecord('cmn_schedule');
scheduleRecord.get('name',scheduleName);
var scheduleGlide = new GlideSchedule(scheduleRecord.sys_id,scheduleRecord.time_zone);
return scheduleGlide.isInSchedule(taskCreated);
}
------------------------------
It should work when you call it like
var inc = new GlideRecord('incident')
inc.get(thing,thingthatmatches)
taskCreatedWithinSchedule(inc,'8-5 weekdays')
-------------------------
I'm just really really stuck on how to edit the default code below to incorporate the custom function.
// True if an instance of this SLA should be attached and started
attach: function() {
if (!this._conditionMatches(this.sla.start_condition))
return false;
return (!this.complete() && !this.cancel()); // don't start, if completion (stop) condition is also true
},