- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 07:10 AM
Hi,
i want to close PRB when related incidents all closed, if even one incident is in Working Progress then PRB should not closed.should be close all incidents then after only close PRB.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 07:48 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 07:36 AM
Create an after business rule on incident table
when: After insert and update
Conditions: state changes to Closed AND Problem is not empty AND Problem.state is not closed
Script:
var gr= new GlideRecord("incident");
gr.addQuery("problem_id",current.getValue("problem_id"));
gr.addQuery("sys_id",'!=',current.getValue("sys_id"));
gr.addQuery('state','!=','7');
gr.query();
if(!gr.hasNext()){
var prb= new GlidRecord("problem");
prb.get(current.getValue("problem_id"));
prb.state='7';
prb.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 07:45 AM
you script is working in redirectional way..
when PRB closed then INC's resolved ......but my Request is when you try to Close PRB then it ishould check all INC 's are closed or Not, even one INC in active then should not allow to PRB close.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 07:52 AM
Here you go. Before business rule on problem table
When: before insert and update
Conditions: State changes to closed
script:
var gr= new GlideRecord("incident");
gr.addQuery("problem_id",current.getValue("sys_id"));
gr.addQuery('state','NOT IN','6,7');
gr.query();
if(!gr.hasNext()){
gs.addErrorMessage("Problem cannot be closed becuas ethe associated incident are not resolved/closed");
current.setAbortAction(true);
}