- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 02:17 AM
Hi there,
I am trying to achieve the following and unsure how to go about it:
If a Case is closed or resolved, I want all connected Incidents that are not already resolved or closed to be set to state resolved.
What's the best way to achieve this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 03:54 AM
Hey
Create an after Update Business rule.
Here it is shown for problem, similarly you can do for your case table.
Below Code snippet should help:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addActiveQuery(); //Cross check only active incidents
gr.addQuery('problem_id', current.sys_id);
gr.query();
while(gr.next()){
gr.state = '6';
gr.close_code = 'Solved (Work Around)';
gr.close_notes = 'The incident is Resolved as the Related Problem is Closed/Resolved';
gr.update();
}
gs.addInfoMessage('The Incident'+ gr.number+' is Resolved');
})(current, previous);
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 02:20 AM
Use After business rule for closing related records
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 02:22 AM
Thanks, are there any examples you could point me to?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 03:54 AM
Hey
Create an after Update Business rule.
Here it is shown for problem, similarly you can do for your case table.
Below Code snippet should help:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addActiveQuery(); //Cross check only active incidents
gr.addQuery('problem_id', current.sys_id);
gr.query();
while(gr.next()){
gr.state = '6';
gr.close_code = 'Solved (Work Around)';
gr.close_notes = 'The incident is Resolved as the Related Problem is Closed/Resolved';
gr.update();
}
gs.addInfoMessage('The Incident'+ gr.number+' is Resolved');
})(current, previous);
Aman Kumar