Need to stop the Response SLA

is_12
Tera Contributor

Hello Community !!

 

Need your help, 

Created one  Response SLA definition which is on the case type table

So now once the assigned to on the sc_task is assigned to someone then, this sla should be stopped 

 

start condition state of case is new or open

Stop condition I have not given anything

 

Created the After BR on sc_task, condition Assigned to changes 

 

(function executeRule(current, previous /*null when async*/) {
    gs.info("sla2");

    if (current.assigned_to) {
       gs.info("sla5");
        var checkCase = current.request.parent;
        if (checkCase) {
            gs.info("sla8");
            // Cancel existing SLA if start conditions are not met
            var taskSLA = new GlideRecord('task_sla');
            taskSLA.addQuery('task', checkCase.sys_id);
            taskSLA.addQuery('sla.target', 'Response');
            taskSLA.addQuery('sla', 'response_sla');
            taskSLA.addActiveQuery();
            while (taskSLA.next()) {
                gs.info("sla15");
                    taskSLA.active = false;
                    taskSLA.update();    
            }
        }
    }


})(current, previous);
 
only sla2 log is coming up
 
Thanks
 
7 REPLIES 7

J Siva
Tera Sage

Hi @is_12 
Is there a specific reason for not using a stop condition? If no, then you can use the below approach. Tweak as required.

JSiva_0-1749713582377.png

JSiva_1-1749713618442.png

JSiva_2-1749713656561.png

Regards,
Siva

GlideFather
Tera Patron

Hi @is_12 ,

to stop a particular SLA, do not use BR, go to the "SLA Definition" on the specific record and check the conditions in Stop, Pause the count. No further configuration is needed.

Please share the stop conditions of your SLA definition

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @is_12 

There is no code required. You can add a condition in SLA itself

 

DrAtulGLNG_0-1749715803956.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

GlideFather
Tera Patron

In the SLA Definition (locate the record where the SLA is not stopping and get to its definition) and there set the conditions similarly to the ones below:

KamilTEL_0-1749718769275.png

 



If you want to stop it upon assignment to any individual, I set the condition that the assigned to is not empty, which means that somebody has been assigned... you can optionally add any other conditions on state or anything else but the Assigned to shall be sufficient to achieve that.

EDIT: it is likely that the SLA definitions for SC_TASK are inherited from the TASK (parent), so consider updating the Task with impact to ALL the extending tables or create a new record for the SC_TASK just and only...

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */