Approvals Being Cancelled Automatically

Lucas Romani1
Tera Contributor

Hi,

 

Currently I am facing a "weird" behavior on RITM approvals on my instance. When I set a RITM to the stage of Request Cancelled, automatically all aprovalls attached to the RITM change their status do Cancelled (even the approvals that were already approved or rejected).

 

Is there a way to limit this behavior to Cancel only approvals that are not yet approved or rejected ?

4 REPLIES 4

DrewW
Mega Sage
Mega Sage

You have two options.  Find the code that is setting them all to cancelled and update it.  Or you can add a BR to the approvals table that will run on update when the state changes to Cancelled from Approved or Rejected and then just set the value back to what ever Previous has for the state field.

 

The later is probably the better option if you really want to keep the state of the approvals.

 

Is there some reason why you want to keep them when the item is cancelled?  It was cancelled so what does it matter who approved it?

 

Hi @DrewW ,

 

First, thanks for the solution propposals.

 

I want to keep the approvals (that already are approved/rejected) without cancelling them just to make visible for the requester on the RITM form view, the status of the approvals.

 

And because on my flows, when an approver rejects the approval, the RITM goes to Closed Skipped state and Request Cancelled Stage. So if all the approvals goes to Cancelled, is not possible to see what approvar reject the RITM and cause the cancelling of it.

Then just add a business rule to the "sysapproval_approver" table that runs before Update and checks the state is changing to cancelled from Approved or Rejected then just do 

 

current.setValue("state", previous.getValue("state"));

 

The only issue will be that it will not run if workflow is turned off when an update is done, which should be rare to never.

 

SanjivMeher
Kilo Patron
Kilo Patron

Looks like there is an OOB BR on the task table, which may be doing it. But changing it would apply to approvals on all tables.

SanjivMeher_0-1712250718517.png

 


Please mark this response as correct or helpful if it assisted you with your question.