Autoclose related incidents when state is onhold, when Problem is resolved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:33 PM - edited 05-08-2024 09:36 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?
@Community Alums @Voona Rohila @Dr Atul G- LNG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 10:05 PM
Hi @Gopal14
To solve this create the after update Business rule on Problem table.
advanced script part:
then resolve the Problem it will close the Associated incidents. before that make note that there is already on OOO Business rule called "SNC - ITIL - Update Related Incidents" so you need to run your Business rule after this as your closing the Incident so.
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks,
BK