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

Hi Mark,

 

this is for all the workflows where tasks are not involved, where the workflow is basic as the screenshot attached in the question and here

Vaishnavi35_0-1688117128787.png

 

I do not see any OOB BR in my instance, I will verify in PDI though once.

 

Thanks,

Vaishnavi

Yeah oke but that's by your design choice. Now you have nothing in your workflow that would set the stage correct on your RITM and therefore the out-of-the-box business rule won't take care of the REQ.

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi Mark,

 

Instead of updating each workflow with state/state, would like to go for BR.

Can you please let me know the name of the BR? the OOB one ?? 

I do not find it in my instance.

 

Thanks,

Vaishnavi

Hmmm good lesson to learn from such then also applying subflows, if having done that, you would have to update only that single subflow and that's it.

 

Anyway, out-of-the-box business rule which handles this, this is how I found it:

1.png

 

Kind regards,
Mark

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Dharma Teja
Tera Contributor

Hi @Vaishnavi35 ,

If you want to stick with OOB instead of creating custom BR's then I would recommend the following:
1. Open the 'End Activity' in the Workflow.
2. Set the stage to 'Completed'.

It would work because there are OOB Business rules which will call script includes to check the stage in the triggered WF end activity before updating the REQ to closure based on RITM state.