Table of Contents
Introduction
We have a requirement to stop SLA clock in ServiceNow on the Incident form whenever there are any existing open Incident Task(s).
In this article, you will understand how to tackle this kind of requirement, and believe me you will not face any issues in the future for this kind of requirement.
Understand the problem
Prerequisites (Configure an SLA on Incident form)
Yes, please configure the response SLA on the Incident form to complete the stop SLA clock in ServiceNow requirement.
Create a True/ False field
To stop SLA clock in ServiceNow and achieve this requirement, we need to create a True/ False field on the Incident form (Open Incident Task(s)).
Remember, we will use this field in the stop condition of SLA.
You also need to consider the fact that this should cater to both scenarios: Incident Task is newly created as well as it getting reopened.
Configure the scripting
Create a Business Rule
You need to create a Business Rule to accomplish this requirement: Stop SLA clock in ServiceNow.
How could you do that?
Name : Set Open Incident Task(s) to True
Table : Incident Task
Advanced : True
When : After (Insert, Update)
Script : (I would recommend copy this code in your instance and try it out)
(function executeRule(current, previous /*null when async*/) {
var incidentNumber = current.parent;
var incidentTaskRecord = new GlideRecord('incident_task');
incidentTaskRecord.addQuery('parent', incidentNumber);
incidentTaskRecord.query();
var hasOpenTask = false;
while(incidentTaskRecord.next()){
if(incidentTaskRecord.state != 3){ //State is not closed
hasOpenTask = true;
break;
}
}
var incidentRecord = new GlideRecord('incident');
if(incidentRecord.get(incidentNumber)){
incidentRecord.u_open_incident_task = hasOpenTask; //u_open_incident_task is True/ False field on Incident Form
incidentRecord.update();
}
})(current, previous);
Explanation
First, we are going to check the parent of incident tasks in the Business Rule, and once we find if any of the Incident Tasks is getting created or reopened then stop SLA clock in ServiceNow.
Configure stop condition of SLA
Now, configure the stop condition of SLA to “Open Incident Task = True”.
Add-ons to stop SLA clock in ServiceNow
Alternate ways
Yes, there are alternate ways to achieve this requirement and this is not the only way to achieve it. But I have tried to explain to you more thoroughly how exactly you can tackle this kind of scenario.
Do you have any other method to resolve it?
If you can resolve this problem in a better way, then do let me know in the comments.
Refer these Resources
Since you are new to it, try to refer to these resources for a better understanding of the fields and Business rules.
22-Day plan to master ServiceNow Scripting
Also, check these as well :
- ServiceNow Docs – For Documentation purposes
- ServiceNow Community – For asking any questions if you are stuck anywhere
Try to solve these problems on your own and then refer to the solution mentioned above- Let’s get into it and solve the problem.
FAQs
How to pause SLA clock in ServiceNow?
SLA can be paused using the Pause condition in SLAs
What is the stop condition in SLA?
SLA can be stopped using the Stop condition in SLAs
What is SLA P1, P2, P3, P4?
P1 is critical, P2 is high, P3 is moderate, P4 is low
What is retroactive pause in SLA?
Retroactive pause increases the breach time.
Why is SLA required?
SLA is required to meet the expectations of Customers by setting reasonable expectations for them by defining the scope for each kind of priority based on various conditions.