RITM state set to 'Closed Complete' when approval is Rejected

SunilKumar_P
Giga Sage

I am using the flow designer for the catalog item process and when the approval is rejected, the stage is set to Request Cancelled but the state of RITM always set to Closed Complete. We would want it to be Cancelled or Closed Incomplete.

19 REPLIES 19

Hi, I am trying to find the script which sets the state to Closed Complete when the stage is set to Request Cancelled but I didnt find any so far. Also, looking into the other scripts.

Hi @SunilKumar_P ,

 

If its still not working you can try writing BR to set the state value of both ritm and request,

You can Try after update BR

Table: sc_req_item

condition as shown below,

Note: better to keep your catalog item in condition so that it will not run for others,

swathisarang98_0-1709023731799.png

 

 

 In action, to update requested item state

swathisarang98_1-1709023731650.png

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

 

 

In advanced, to update Request table

swathisarang98_2-1709023731648.png

 

 

code

(function executeRule(current, previous /*null when async*/) {

	var reqUpdate = new GlideRecord('sc_request');
	reqUpdate.addQuery('sys_id',current.request);
	reqUpdate.query();
	if(reqUpdate.next()){
		reqUpdate.state = 4 ;
		reqUpdate.request_state = 'closed_cancelled';
		reqUpdate.update();
	}

})(current, previous);

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Vishal Birajdar
Giga Sage

Hello @SunilKumar_P 

 

Can you please check in flow after Approval rejected branch, there should be 'Update record' (Requested Item) activity.

Please check there if state has been set correctly...

 

It will be better if you provide screenshot of your flow....!!

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Hi @Vishal Birajdar, Thanks for the response. I have the update record 'action' and even though the flow sets the state to cancelled, the system overrides it to Closed Complete.

 

Thanks,

Sunil

Here is the screenshot.

SunilKumar_P_0-1706612630281.png