Auto resolve case when related inc and chg is resolved and closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 04:19 AM
Hi community
I have this current challenge where I need to auto resolve case (parent) when related inc AND/OR chg, req (childs) are resolved and closed.
I manage to auto resolve case when only incident is resolved, however, when a second task type is related it becomes harder. Any help is highly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 02:12 AM
Thanks for your reply @jaheerhattiwale
Sorry , but how to write this as script in br?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 02:34 AM
@Alex D Great You can create a after business rule on "Task [task]" table as below
Script:
(function executeRule(current, previous /*null when async*/) {
var allTasks = new GlideRecord("task");
allTasks.addQuery("active=true^state!=6"); //6 is resolved state
allTasks.addQuery("parent="+current.parent.toString());
allTasks.query();
if(!allTasks.next()){
var caseGr = new GlideRecord("sn_customerservice_case");
if(caseGr.get(current.parent.toString())){
caseGr.state = 3; //3 is closed state
caseGr.update();
}
}
})(current, previous);
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023