I'm trying this way if all child incidents are closed then parent incident should auto closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2025 11:24 PM
Even after closing the child incident parent incident is not updating.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2025 06:56 AM - edited 10-01-2025 06:56 AM
Hello @ypranavi4,
It looks like the reason your parent incident isn’t updating is because when an Incident is closed in ServiceNow, the platform enforces mandatory fields like Resolution code and Resolution notes. In your current script you’re only setting state and description, so the update fails silently since required fields aren’t being set.
You can fix this by also providing values for those fields before the update, for example:
if (current.state.changesTo('3')) {
var task = new GlideRecord('incident_task');
task.addQuery('incident', current.incident); //for incident task parent, the field is incident
task.addQuery('state', '!=', '3');
task.query();
if (!task.hasNext()) {
var inc = new GlideRecord('incident');
if (inc.get(current.incident)) {
inc.state = '7'; // Closed
inc.close_notes = "Incident tasks are closed, hence closing the incident";
inc.close_code = "No resolution provided"; // required field
inc.setWorkflow(false);
inc.update();
}
}
}This way, the parent incident can transition to the Closed state successfully, since both resolution code and notes are being populated.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
