Stop SLA when Assignment group changes

AniketN
Tera Contributor

Hi,
I want to stop SLA when Assignment group changes, I did not found any way to do it through SLA definition.

AniketN_0-1728479118327.png

Can you please help me!!

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @AniketN,

 

This is possible, however sadly it's not as easily configurable as the condition builder.

You can actually override conditions within SLA's (more info in the link found below), but in short you're going to have to script this using a Script Include. You can then point to this Script Include from your SLA by populating the 'Condition type' field. (This is not displayed by default I believe).

 

Take a look at the link. You can fully customize and control the stopping of an SLA via the 'complete: function(){ ... code goes here }

 

https://docs.servicenow.com/bundle/xanadu-it-service-management/page/product/service-level-managemen...

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

View solution in original post

8 REPLIES 8

Hi @AniketN,

 

Happy to help and glad we found a solution that works for you.

I'll happily help you with the followup question - however, can you do me a favour please -

so as to help others and for me to gain recognition for my efforts, please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Siddhesh Jadhav
Kilo Sage

Hi @AniketN ,

 

You can stop the SLA when the Assignment group changes by creating a business rule. Here's a brief approach:

1. Create an after-update business rule on the target table (e.g., `Incident`).
2. In the condition, check if the Assignment group field has changed.
3. Use the following script to stop the specific SLAs for that record:

 

(function executeRule(current, previous /*null when async*/) {
    var slaGR = new GlideRecord('task_sla');
    slaGR.addQuery('task', current.sys_id);
    slaGR.addActiveQuery();
    slaGR.query();
    
    while (slaGR.next()) {
        slaGR.stage = 'cancelled';  // Update the stage to 'cancelled'
        slaGR.update();
    }
})(current, previous);

 

This approach will cancel the SLA when the assignment group is updated.

 

If this helps, please mark it as accepted and helpful.

 

Thanks & Regards,
Siddhesh Jadhav 

AndersBGS
Tera Patron
Tera Patron

Hi @AniketN ,

 

 can you elaborate on the “why”? What is the business requirement in relation to this/these SLA?

 

Is my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

 Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Mark Manders
Mega Patron

It sounds like a weird requirement from an SLA point of view. An SLA is an agreement of Service Level. A ticket is created and should be responded to/get resolved within X time. It shouldn't matter who responds/resolves, the agreement is for the service to be back restored within that time.

 

It sounds more like a 'we need to report on how long a group works on a ticket' kinds of requirement. And that is already measured (depending on the table) through metrics (and if not OOB available, it is an easy copy from one that does exist). It will show you exactly the time a task got assigned to a group, to the time it's set to another group.

 

I will repeat AndersBGS's question: why. What is your requirement? Because setting BR's to cancel records that are running on the SLA engine doesn't really sound like a proper solution. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark