The Zurich release has arrived! Interested in new features and functionalities? Click here for more

SLA Clock refresh

Sam Ogden
Tera Guru

Hi,

On our incident form we have a field u_remaining_sla_time (screenshot below).   This field is update by a business rule which runs on insert and update and just takes the current.business_time_left and populates it in this field.

find_real_file.png

We have the issue though that we need this field to refresh at regular intervals without going into the log.

Our managers want to be able to see from list view an accurate remaining SLA time.

I have seen that SLA refresh is controlled by the following scheduled jobs:

  • SLA update (breach after 30 days): repeats every 5 days
  • SLA update (breach within 1 day): repeats every hour
  • SLA update (breach within 1 hour): repeats every 10 minutes
  • SLA update (breach within 10 min): repeats every 1 minute
  • SLA update (breach within 30 days): repeats every day
  • SLA update (already breached): repeats every         day

However I cannot seem to find in the system where these are held (I've looked under system definitions > Scheduled Jobs), can anyone help?

Also what would be the best solution so that from list view we can see the remaining SLA time and this is refreshed say every 30 mins?

Any help is greatly appreciated.

3 REPLIES 3

Joe McCarty1
ServiceNow Employee
ServiceNow Employee

Have you tried setting the glide.sla.calculate_on_display property to update whenever the task is viewed?



SLA Engine properties



Otherwise there is an esoteric internal algorithm that decides when to update.


Hi Joe,



This is already set to true


find_real_file.png


We have the following business rule which is used to populate the u_remaining_sla_time filed


find_real_file.png


find_real_file.png



We are currently having to go into each log and go to the running clock and click refresh for the u_remaining_sla_time to update.



Ideally what we want is for this field to update on a regular basis e.g. every 30 or 1hour etc



This would then allow our managers to view this field from list view and get an accurate idea of the remaining SLA without having to go into each individual log.



Any help/advise on what we need to change to achieve this will be greatly appreciated.



Thanks


Looks like the SLA engine doesn't trigger rules on recalculations, just insert.   You can setup a scheduled job on 30 minute/1 hour intervals (depending on requirements and performance) using:



var sla = new GlideRecord('task_sla');


sla.addQuery('stage', 'in_progress');


sla.addQuery('task.sys_class_name', 'incident');


sla.query();




while (sla.next()) {


  if (!sla.end_time.nil())


  SLACalculatorNG.calculateSLA(sla, /* skipUpdate */ false, sla.end_time);


  else


  SLACalculatorNG.calculateSLA(sla, /* skupUpdate */ false);



  var inc = new GlideRecord('incident');


  if (inc.get(sla.task)){


  inc.u_remaining_sla_time = sla.business_time_left;


  inc.setWorkflow(false); //Maybe you want to turn off business rules


  inc.update();


  }


}



This worked on my instance.