How to configure 'Stage' as 'Request Cancelled' and 'State' as cancelled using Flow Designer?

priyanka0709
Tera Contributor

Hi...We have a requirement to configure a Flow Designer to set 'Stage' as 'Request Cancelled' and 'State' as 'Cancelled' for a RITM in ServiceNow, whenever an Approver Rejects the approval for RITM. We have configured our flow with Update request item action and setting Stage and State fields with these values.

4 REPLIES 4

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @priyanka0709 

 

Did you use "update record" activity? in update record activity , you can select record as RITM from right panel and set the state to "Cancelled". 

AND

You can use 'stages' to manage the current stage. If you however on the line between actions (so before your requested item) you will see an option appear to add a stage. 

You can manage stages from the options of your Flow, to use existing ones or create new ones.

SohithanjanG_0-1709568056488.pngSohithanjanG_1-1709568074025.png

Can be a bit clunky, but just however your mouse over the line break (where you see the grey line) and an add stage button appears where you can control stage behaviour

 

 

🙂

 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

We have a requirement to configure a Flow Designer to set 'Stage' as 'Request Cancelled' and 'State' as 'Cancelled' for a RITM in Servicenow, whenever an Approver Rejects the approval for RITM. We have configured our flow with Update request item action and setting Stage and State fields with these values. However , while testing Rejection Approval , we found that it is setting Stage correctly to "Request Cancelled", but setting State to random value e.g. On Hold, Pending etc.

Could anyone help us how do we set the state to "Cancelled" value upon Approval Rejection? 

NOTE: We want it to set automatically via Flow designer and not via any 'Cancel' button on form. It is not showing 'Cancel' option in current RITM state field. May be this is the reason Flow is also not getting the Cancel value. How can we display Cancel value under State drop down for our RITM? (We already have State value defined in ServiceNow , but still is does not show under State drop down). Please find screenshots.

swathisarang98
Giga Sage
Giga Sage

Hi @priyanka0709 ,

 

 You can set the RITM stage by using Flow stages and once the stage is set based on that we can set the RITM state and request state to closed incomplete through Business rule,

 

swathisarang98_0-1709568389315.png

swathisarang98_1-1709568451938.png

 

 

 

(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

Himani_14
Mega Sage
Mega Sage

Hi @priyanka0709 ,

 

Please check if below screenshot helps you. It is updating 'Requested Item' table 'State' and 'Stage' when approval gets rejected.

 

Himani_14_0-1709569177090.png

 

Thanks

Himani