how to set approvers to no longer requested when parent ritm is cancelled
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
02-28-2025 04:06 AM
Hi can anyone please help me with code correction for written below:
requirement is that when the parent RITM is cancelled for the catalog item, the approvers need to be set to ' no longer requested' for the child RITM'S
wriiten an after business rule and code is :
if (current.state == 'Canceled' && !current.parent.nil())
{
var parentRITM = current.parent;
var grChildRITMs = new GlideRecord('sc_req_item');
grChildRITMs.addQuery('sgdc_ref', current.request);
grChildRITMs.query();
while (grChildRITMs.next()) {
if (grChildRITM.state ! = 4)
grChildRITM.state = 4;
ChildRITM.update();
}
var grApprovals = new GlideRecord('sysapproval_approver');
grApprovals.addQuery('document _id', grChildRITMs);
grApprovals.addQuery('state', '!=', 'closed');
grApprovals.query();
while (grApprovals.next()) {
grApprovals.state = 'not_requested';
grApprovals.update(); } }
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
02-28-2025 04:46 AM
please share complete business rule script and BR is on which table and what's the condition?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
