Question on SNC.RequestItem(current).closeParentRequest()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:20 PM
Hey everyone,
I'm wondering if the SNC class functions only work on OOTB Business Rules? Reason why I'm asking is I'm trying to mimic the OOTB BR "Close Parent if Required" by making a copy and modifying it to look at "state". See screenshot below
However my BR is not doing what the OOTB does when the condition hits.
Can anyone shed some light on the reason why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 08:39 AM
Good point Erik. We were wondering if this script is smart enough to check if there are any open RITMs under the parent REQ. I'm hoping SN is thinking of this too.
We ended up writing a scripted report to get all the active REQs where there is one and only 1 closed RITM.
With the report, we'd be able to see which REQ is still open where the RITM is still active.
Here's the script include:
var RITM_Check_Report = Class.create();
RITM_Check_Report.prototype = {
initialize: function() {
},
checkReport: function(){
var requests = [];
var check = 'false';
var gr = new GlideRecord('sc_request');
gr.addQuery('active',true);
gr.query();
while(gr.next()){
var rId = gr.sys_id.toString();
var ritmCheck = this.checkRITMs(rId);
if(ritmCheck === 'true'){
requests.push(rId.toString());
}
}
return requests;
},
checkRITMs: function(rId) {
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('active=false^request='+rId);
gr.query();
var ritmCount = gr.getRowCount();
if(ritmCount == 1){
return 'true';
}
},
type: 'RITM_Check_Report'
};
Seems to get us what we need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 05:52 AM
Hello, I realize I'm a couple years late to the conversation; but I have a question; does this BR - or the class method closeParentRequest() - add the work notes "Request Automatically Closed as all Line Items were complete"?
I am looking to find where that exact string of text comes from.
Any help would be very appreciated.