Request (REQ) should close once the RITM is closed

Vaishnavi35
Tera Guru

Hi,

 

Once the RITM is closed the REQ is not closing.

RITM's having tasks or workflows are involved REQ is getting closed correctly.

 

But the RITM's where tasks are not there REQ form is not getting closed.

Vaishnavi35_0-1688110096037.png

 

Help?

 

Thanks,

Vaishnavi

1 ACCEPTED SOLUTION

Hi @Vaishnavi35 ,

try this 

 

(function executeRule(current, previous /*null when async*/ ) {
	var grReq = new GlideRecord('sc_request');
	grReq.addQuery('sys_id', current.request);//get the request from RITM
	grReq.query();
	if (grReq.next()) {
		grReq.request_state = 'closed_complete'; //add your field  name
		grReq.update();
	}
})(current, previous);

 

  

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

14 REPLIES 14

Pavankumar_1
Mega Patron

Hi @Vaishnavi35 ,

are you trying to achieve it through workflow?

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

No. Business rule but it does not work.

@Vaishnavi35 

there  should be after business rule on RITM, when ritm state changes to close complete ,request should be in closed complete 

could you plz share your. business rule script

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact

Thanks,

Manjusha Bangale

Vaishnavi35_3-1688117691502.png

(function executeRule(current, previous /*null when async*/ ) {
	var grReq = new GlideRecord('sc_request');
	grReq.addQuery('sys_id', current.request);//get the request from RITM
	grReq.query();
	if (gr.next()) {
		gr.state = 'closed_complete';
		gr.update();
	}
})(current, previous);

 

But the code does not work.