Reset conditions in SLAs

ethal
Kilo Contributor

I know that this has been a topic discussed on the forum several times before, but I believe it needs to be revisited. There does not appear to be solution for creating a reset condition based on re-assignment of Incidents. An example of the need for this is that a ticket is initially assigned to a group, but re-assigned thereafter - we'd like a condition that resets the SLA when the assignment group CHANGES. The new SLA engine does not appear to offer this feature, nor does it appear possible to create a script within an SLA (as was the case with the old SLA engine). Has anyone managed to get this to work or is the only way to accomplish this through new functionality? (thus, an enhancement request is necessary).

14 REPLIES 14

It would be great if you could document your solution here.


That's great is there any documentation for this?


sylvain_hauser
Tera Contributor

Here is how to create a business rule to create automatically on group creation.
Basically, the idea is that when you create a new group, automatically the system will add 5 OLAs linked to the group.

First, create a new field "Group" in the SLA table (u_group) in order to have a link from the SLA to the group (n-1 relationship).

------------------------------------------------------------------------------------------------

Business Rule (done by Jerrod)
Name: Create SLA's
Table: Group (sys_group)
Order 100
When: After
Insert ON

SCRIPT:
//Create 5 new SLAs upon the insertion of any new group

createSLA('1', 14400000); //4 hours in ms
createSLA('2', 14400000); //4 hours in ms
createSLA('3', 57600000); //16 hours
createSLA('4', 216000000); //2 days 12 hours
createSLA('5', 216000000); //2 days 12 hours


//The create SLA function takes a priority value, and a duration in milliseconds
function createSLA(priority, durationMS) {
var sla = new GlideRecord('contract_sla');
sla.initialize();
sla.name = current.u_code + ' OLA P' + priority;
sla.type = 'OLA';
sla.collection = 'incident';
sla.duration.setDateNumericValue(durationMS);
sla.start_condition = 'assignment_group=' + current.sys_id + '^priority=' + priority + '^EQ';
sla.pause_condition = 'incident_state=4^EQ';
sla.stop_condition = 'assignment_group!=' + current.sys_id + '^ORincident_state=6^ORincident_state=7^EQ';
sla.u_group = current.sys_id;
sla.insert();
}

------------------------------------------------------------------------------------------------


If you already have some groups, you can simply flag the UPDATE option temporally, do a mass update on your current groups, and unflag it.

The beauty is that you can manage exeption with this method.


To be consistent, you can create the following business rule in order to delete the SLAs linked to the group on Deletion


------------------------------------------------------------------------------------------------
Business Rule (done by Jerrod)
Name: Delete SLA's
Table: Group (sys_group)
Order 100
When: After
Delete ON

gs.addInfoMessage('Deleting all SLAs associated with group ' + current.getDisplayValue());
//Delete all SLA's associated with this group

var oldSLA = new GlideRecord('contract_sla');
oldSLA.addQuery('u_group', current.sys_id);
oldSLA.query();
while (oldSLA.next()) {
gs.addInfoMessage('Deleted SLA - ' + oldSLA.getDisplayValue());
oldSLA.deleteRecord();
}
------------------------------------------------------------------------------------------------


Now, on each assignment group change, the previous OLA will stop, and a new one will be created for the new group. The report will be possible at the group or task level!

Let me know if you have any question
Sylvain


Christopher8
Tera Contributor

I am running into the exact same situation as the original poster. I am looking for a solution to reset a SLA on group re-assignment.

We are not prepared to set up several hundred SLA's and would also like to find a solution to 'Group has changed, reset SLA'. Besides the solution provided below, has anyone had any luck finding a simple elegant way of doing this?

edit: After reading the solution provided below several times, I have come around to like the idea and have decided to give it a shot.


Happy it helps