- 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:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2018 07:42 AM
Mark,
your script is working fine, but is it allowing only iwhen INC is closed, can we able to give access even if INC is resolved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2020 02:11 AM
Hi Chanikya,
Please try the below modified code of Mark's.
var inc = new GlideRecord('incident');
inc.addQuery('problem_id', current.sys_id);
inc.addQuery('state','!=','6');
inc.addOrCondition('state','!=','7');
inc.query();
if(inc.hasNext()) {
// If we find even one incident open, abort the update
current.setAbortAction(true);
gs.addErrorMessage('One or more incidents is still open and must be closed before closing this problem record.');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2018 07:22 AM
Try an before update BR when state changes to closed.
var incident = new GlideRecord('incident');
incident.addQuery('parent', current.sys_id);
incident.addQuery('parent.state', '!=',7); //closed
incident.addQuery('parent.state', '!=',6); //resolved
incident.query();
var count = incident.getRowCount();
if(count != 0){
gs.addInfoMessage("You have "+count+" open incident which must be completed before this record can be closed");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2018 07:30 AM
not working