Updating SLA start and breach times

TK36
Kilo Contributor

Hi,

I am a new entrant in service now world and require your expert opinions.

We have a service catalog request for new starters. This request can have multiple request items and while raising this request - we have to provide an "employment start date". This is stored in a variable called 'u_employment_startdate'. Based on this date - the SLAs for tasks get calculated.

Now there is a requirement:

1. To be able to update this "employment start date" are Request level

2. It should then update all RITMs

3. Recalculate the SLAs.

I have been able to achieve points 1 and 2 via business rules. However I am stuck on how to do step 3 recalculating the SLAs. We have got custom SLAs, so the "repair SLA" functionality from service now doesnt help.

Please can somebody advise what is the best way to achieve this?

3 REPLIES 3

LisaKomidar
Giga Guru

First - You need a business rule that updates the start date on the related RITMs when it is updated in the Request. 

SNC - ITIL - Close Related Business rule for Problems is a good example of how you would go out and search for related items.

 

if (current.problem_state.changesTo(4)) {    //   CHANGE THIS TO BE A CHECK ON IF THE START DATE FIELD IS CHANGED
closeRelatedIncidents(current);   // MODIFY THIS TO BE addStartDateToRITMS(current);
closeRelatedTasks(current);   // DON'T NEED THIS
}

Adding notes in CAPS.  Throughout the code, replace 'incident' with something more applicable like 'item'

//
// Close any incidents that are related to the current problem
//
function closeRelatedIncidents(me) {   // MODIFY THIS TO MATCH FUNCTION ABOVE
var incident = new GlideRecord("incident");    // MODIFY THIS TO BE sc_req_item
incident.addQuery("problem_id", "=", me.sys_id);   //  MODIFY TO BE 'request'
incident.query();
while (incident.next()) {
if ( incident.active == true ){  // GOOD TO CHECK TO MAKE SURE THE RITM IS ACTIVE AS WELL
var msg = gs.getMessage("Incident {0} closed based on closure of problem {1}", [incident.number, me.number]);

gs.print(msg);   // YOU DO NOT NEED TO PRINT IF YOU DON'T WANT


incident.incident_state.setValue(IncidentState.CLOSED);   // YOU AREN'T CLOSING.  YOU WILL SET THE START DATE FIELD
incident.active.setValue(false);  // REMOVE
incident.comments = msg;  // ADDING A COMMENT IS ALWAYS GOOD
incident.update();   // UPDATE YOUR RITM
}
}
}

 

Then in your SLA definition, on the Reset tab, add a condition that says when the start date changes, it resets.

 

 

TK36
Kilo Contributor

Thanks a lot for your reply.

I have written business rule on similar lines which updates the start date for all RITMs.

With regards to last point about resetting the SLA - you have suggested to add reset condition. However we have many SLAs and instead of modifying each, can this be done programmatically via Business rule i.e. force the SLA to recalculate via code?

 

There probably is however, I have not looked into that because I believe that SLAs are so important to the ITIL process that I keep them OOB.  Any updates could break any customization and the SLA area is one place I would hate to see that happen.  Someone else may have code examples of modifying SLAs via a business rule.