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

I'm trying this way if all child incidents are closed then parent incident should auto closed

ypranavi4
Giga Contributor
(function executeRule(current, previous /*null when async*/ ) {

    if (current.state.changesTo('7')) {
        var task = new GlideRecord('incident_task');
        task.addQuery('incident', current.parent_incident);
        task.addQuery('state', '!=', '7');
        task.query();

        if (!task.hasNext()) {
            var inc = new GlideRecord('incident');
            if (inc.get(current.parent_incident)) {
                inc.state = '7';
                inc.description = "incident tasks are cosed hence closing the incident";
                inc.setWorkflow(false);
                inc.update();
            }
        }
    }

})(current, previous);



Even after closing the child incident parent incident is not updating.
0 REPLIES 0