exceed time limit when closing parent ticket

RaginiP
Tera Contributor

We have observed an issue where, upon closing a parent ticket, not all the child tickets are getting closed. Out of 734 child tickets, only 260 were closed. A popup message appears stating that the time limit has been exceeded, and the remaining tickets remain in the Open state.

We have an Async Business Rule in place to close all child tickets when the parent security incident is closed. What could be the reason that not all child tickets are closing? Out of 734, only 260 were closed, and an error indicating “exceeded time limit” is being thrown.

Is there any system property or any other platform limitation causing this issue? Please help us understand and resolve this.

Thanks in advance.

1 REPLY 1

Naveen20
ServiceNow Employee

The core issue is the transaction execution time limit. ServiceNow enforces a maximum runtime for any single transaction — including Async Business Rules. The relevant system property is:

glide.script.timeout.max — This controls the maximum execution time (in milliseconds) for a script transaction. The default is typically 300 seconds on most instances, though it can vary.


Try this - Events + Script Action approach


Step 1: Register the Event

Go to System Policy → Events → Registry and create a new event:

Field Value
Suffix custom.close_child_security_incident
Table sn_si_incident (your child table)
Description Closes a child security incident when parent is closed

Step 2: Async Business Rule (on Parent table)

This replaces your existing BR. Instead of closing children directly, it queues an event per child:

(function executeRule(current, previous) {
    var gr = new GlideRecord('sn_si_incident');
    gr.addQuery('parent', current.sys_id);
    gr.addQuery('state', '!=', 7); // exclude already closed
    gr.query();

    while (gr.next()) {
        gs.eventQueue('custom.close_child_security_incident', gr, 
                       current.sys_id, gs.getUserID());
    }
})(current, previous);

Step 3: Script Action

Go to System Policy → Events → Script Actions and create:

Field Value
Name Close Child Security Incident
Event name custom.close_child_security_incident
Active true

Script:

(function run(event) {
    var childId = event.parm1 ? event.instance : '';
    if (!childId) return;

    var gr = new GlideRecord('sn_si_incident');
    if (gr.get(event.instance)) {
        // Verify parent is still closed before closing child
        var parent = new GlideRecord('sn_si_incident');
        if (parent.get(event.parm1) && parent.state == 7) {
            gr.state = 7; // Closed
            gr.close_notes = 'Auto-closed: Parent incident ' + parent.number + ' was closed.';
            gr.update();
        }
    }
})(event);

Why this works: Each event fires in its own transaction, so there's no cumulative timeout. Even with 734+ children, the Event Queue processes them individually — if one fails, the rest still proceed. No system property changes needed.