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

How to apply new SLA to old tickets using script

Rakesh50
Mega Sage

Hi,

We made a change to the SLA Workflow, which now applies to new tickets. However, we need to update the new SLA for old tickets in production without using the SLA Repair functionality. We have three groups, each with its own SLA definition. When a group changes, the corresponding group's SLA gets attached to the ticket. Our current approach is to reset the group value to "None," save it, and then set it back to "Group1" to attach the new SLA Workflow. This approach seems to work for tickets without any members in "Group2." However, when "Group2" has members, the value is not set to "None"; instead, it remains as "Group2." There's already a logic in place that executes this behavior. If we try to avoid using "setWorkflow(false)," the SLA Workflow doesn't get attached. We would appreciate guidance on whether this approach is correct or if there's an alternative method. Please advise.

4 REPLIES 4

SNUG AM
Giga Guru

This approach seems to work for tickets without any members in "Group2." However, when "Group2" has members, the value is not set to "None"; instead, it remains as "Group2." ??

 

is it working or not ? 

 

Best Practice is : when changes to assignment group  need to set assigned to as none[blank]. 

 

Based on your statement not clear what conditions its getting failed.. is it because assigned to value is exist for Group2 ?

@SNUG AM Thank you for the response.

This approach seems to work for tickets without any members in "Group2." However, when "Group2" has members, the value is not set to "None"; instead, it remains as "Group2." ??

 - Yes, If i'm trying to reset the group "Group1" value to "None" if group "Group2"  having any members it is not setting to "None" setting as "Group2". [Existing business logic is working ]

 

 

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @Rakesh50 

Could you pls tell me What is the challenge in using Repair SLA Functionality Rakesh?

You can refer:

https://www.servicenow.com/community/developer-forum/how-to-add-quot-run-sla-calculation-quot-to-a-s...

 

The above article calculates the SLA and updates, where as in your case, you have to attach another SLA definition. I know this is not exactly what you're looking for, but you can refer and use encodeQuery to apply to your list of records.

 

Help others to find a correct solution by marking the appropriate response as correct answer and helpful!!

 

Regards,

Ravi Chandra.

@Ravi Chandra_K , thank you for your response.

The reason we cannot use the Repair SLA functionality is that it maintains the same business elapsed time. However, we still require new SLA definitions for the old tickets.

 

In the thread that you shared, the calculation of the SLA was discussed. However, my specific requirement is to attach a new SLA workflow with a revised duration for the old tickets in production.