Pending RITM approvals not getting cancelled when one of the pending approvals is rejected

Mussie
ServiceNow Employee
ServiceNow Employee

Hi Guys,

I have a requirement where there will be concurrent and consecutive approvals. My workflow works fine when approved because I used join activity for approvals. However, when one of the approvers reject the ritm request, all the pending approvals need to be cancelled. At the moment, they are still remaining as requested. Can you check the below workflow and see if you can point out anything that I am missing:

find_real_file.png

Mussie

1 ACCEPTED SOLUTION

Mussie
ServiceNow Employee
ServiceNow Employee

Hi Guys,


Thanks for your help, this is now resolved. I used a 'run script' to set the records to 'rejected' and this seem to have resolved the issue. I initially made the mistake of setting the records to cancelled but it looks like when the records are set to cancelled the approval were still active and giving me some unpredictable results.



Run Script - Cancel Pending Approvals



var gr = new GlideRecord ('sysapproval_approver');


gr.addQuery ('sysapproval', current.sys_id);


gr.addQuery('state', 'requested');


gr.query();


while (gr.next()){


  gr.state = 'rejected';


  gr.update();


}



find_real_file.png


Mussie


View solution in original post

4 REPLIES 4

Geoffrey2
ServiceNow Employee
ServiceNow Employee

Hi Mussie,



I think the workflow is working as expected. By branching the 2 approvals you are making them independent of each other.   But it sounds like your requirements is to set it so that if 1 is rejected, then the Request is rejected and the other approvals should be cancelled or something. It sounds like you need to combine the Approvals into one Activity, list both Users or Groups, and set Wait for to Everyone to approve.


Capture.PNG


Kalaiarasan Pus
Giga Sage

You might try to use an approval coordinator and add all the approval activities inside it. Control the approval and rejection logic using the approval coordinator.


Hi Guys,


Adding approval coordinator isn't working for me. This is probably because some of my approval are concurrent and some of them are consecutive. Any other ideas?Mussie


Mussie
ServiceNow Employee
ServiceNow Employee

Hi Guys,


Thanks for your help, this is now resolved. I used a 'run script' to set the records to 'rejected' and this seem to have resolved the issue. I initially made the mistake of setting the records to cancelled but it looks like when the records are set to cancelled the approval were still active and giving me some unpredictable results.



Run Script - Cancel Pending Approvals



var gr = new GlideRecord ('sysapproval_approver');


gr.addQuery ('sysapproval', current.sys_id);


gr.addQuery('state', 'requested');


gr.query();


while (gr.next()){


  gr.state = 'rejected';


  gr.update();


}



find_real_file.png


Mussie