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

is_12
Tera Contributor

@GlideFather @Dr Atul G- LNG @J Siva SLA is on the case where as assigned to is on the sc_task table

dot walking in the filter condition is also not available

 

Can we achieve this by the custom SLA condition rule

if anyone have an idea on this, can you help me with that

sc_task is extending from the task table, but can you pelase share your stop conditions?

review the screenshot I attached above in this thread and try to do it similarly to meet your requirements. 

just be careful, if you have it on the task table, change to it would impact all the other extending tables (incident, changes, problems, etc). do you want the same behaviour for all kind of task records or just and only sc task?

if the 1) update the task,
if 2) create a new sc_task sla definition

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


@is_12 I don't think it's possible without adding a custom date/time field on the sc_task table to capture the Case creation date/time. If there's an option to create such a custom field and populate it at the time of task creation, then you can simply create an SLA on the sc_task table and use the 'Retroactive start' and 'Set start to' fields like below. Select the custom date/time field in the 'Set start to' field.

JSiva_0-1749729199949.png