Query Related to Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
"When an incident is resolved, if it is linked to a problem, the system should check if all other
related incidents are also resolved and then automatically resolve the problem after saving."
This is a scenario, How can i do this scenario give me the right code to implement it.
Note: Don't tell me the AI-related code.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Create a after update Business rule
Condition : State changes to Resolved
Script :
if (current.problem_id.nil()) {
return;
}
var p = new GlideRecord('problem');
if (!p.get(current.problem_id)) {
return;
}
var i = new GlideRecord('incident');
i.addQuery('problem_id', current.problem_id);
i.addQuery('state', '!=', 6);
i.addQuery('sys_id', '!=', current.sys_id);
i.query();
if (!i.hasNext()) {
p.state = 6;
p.close_code = 'Solved (Permanently)';
p.close_notes = 'Auto-resolved as all related incidents are resolved';
p.update();
}
Do let me know if you need any explanation of the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
ideally it happens reverse
When PRB is closed then related INCs associated to this PRB are closed
This happens with OOTB BR "SNC - ITIL - Close Related"
Close related Incidents upon closing a Problem
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
