How to Close RITM when SCTASK is Closed using Business Rules
// Add your code herevar sct = new GlideRecord('sc_task');sct.addQuery('request_item', current.request_item);sct.query();
var totalCount = sct.getRowCount();
var sct1 = new GlideRecord('sc_task');sct1.addQuery('state', IN, '3,4,7');sct1.addQuery('request_item', current.request_item);sct1.query();
var completedtotalcount = sct1.getRowCount();
if (totalCount == completedtotalcount) {var ritm = current.request_item.getRefRecord();ritm.state = 3;ritm.update();
}
})(current, previous);
If my video/content helped you in any way, please mark this video/content as BOOKMARK, SUBSCRIBE & HELPFUL
Best Regards,
Prashant Kumar (LearnIT)
YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant
Blog LearnIT: https://medium.com/@LearnITbyPrashant
Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/
ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635
https://www.servicenow.com/community/developer-blog/how-to-close-ritm-when-sctask-is-closed-using-business-rules/ba-p/2436386