Autoclose related incidents when state is onhold, when Problem is resolved
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:25 PM
Hi Team,
I need to Autoclose related incidents when state is onhold, when Problem is resolved
I have written After Insert or update Business rule on problem table.
Below is my code.
var incidentGr = new GlideRecord('incident');
incidentGr.addQuery('problem_id', current.sys_id);
incidentGr.addQuery('state', 3);
incidentGr.query();
// Loop through related incidents and close them
while (incidentGr.next()) {
incidentGr.state = 6;
incidentGr.close_notes = "Automatically Resolved due to resolution of associated problem: " + current.number;
incidentGr.update();
}
Code is not working, Do I need to change anything?
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 12:52 PM
You should not have to do anything for this. Out of the box if the state is on hold and the on hold reason is awaiting problem it will automatically close the incidents.