Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

SLA Pause and Stop conditions

SivaNagaM
Tera Expert

I have a requirement, where user requested to pause the sla on sc_task tickets when it is moved to closed complete state until 7 days from closed at time. After 7 days from closed at time it should complete the sla which is running. if in case user reopened the task, the same sla should run without tagging a new sla.

 

Is this can be achievable by condition builder or any other approach?

2 REPLIES 2

Sneha KH
Tera Guru

To achieve this, you cannot use the standard Condition Builder alone because the SLA engine usually completes an SLA immediately when a "Stop" condition is met. You need a combination of a custom Pause Condition, a Scheduled Job, and a "Waiting" State.

1. Create a New State: "Pending Closure" (Optional but Recommended)

Instead of moving directly to "Closed Complete," move the task to a transitional state (e.g., Pending Closure).

2. Configure the SLA Definition

Go to your SLA Definition for sc_task and set the following:

  • Start Condition: state is open (or your usual start).
  • Pause Condition: state is pending closure. (This is the key. While in this state, the "Time Left" clock stops).
  • Stop Condition: state is closed complete.
  • Reset Condition: (Leave blank so it doesn't start a new one on reopen).

3. The "7-Day" Automation (Scheduled Job)

Since the SLA won't finish itself, you need a script to "push" the ticket from Pending Closure to Closed Complete after 7 days.

Create a Scheduled Script Execution:

  • Run: Daily.
  • Script: 
    var taskGR = new GlideRecord('sc_task');
    // Find tasks in 'Pending Closure' where the 'Closed' (or a custom date field) was 7 days ago
    taskGR.addQuery('state', '3'); // Assuming 3 is your 'Pending Closure' code
    taskGR.addEncodedQuery('u_moved_to_pending_closure_atRELATIVELT@dayofweek@ago@7'); 
    taskGR.query();
    while(taskGR.next()){
    taskGR.state = 4; // Move to 'Closed Complete' (The Stop Condition)
    taskGR.update();
    }

Tanushree Maiti
Kilo Patron

Hi @SivaNagaM 

 

Customization is required to achieve it .

 

  • Custom Field: Add a u_closed_task (Date/Time) field to sc_task table
  • In SLA definition
    Pause on CloseSLA Pause Condition: State is Closed Complete
    Resume on ReopenSLA Resume Condition: State is not Closed Complete

     

  • Set up a scheduled job that runs daily to identify sc_task records where the state is Closed Complete and the u_closed_task field is at least 7 days old. For those records, use a script to update the task_sla record to Completed.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: