Cancelling approvals in change

scottjus82
Kilo Guru

Hi all,

 

I now have a requirement to provide a back out button after a change has been approved but before it is implemented (mainly due to customers cancelling a change at the last minute) I have added a blackout button to the change form (very visually focused here) Clicking the button changes the phase back to draft mode (in Definition) so it can then go through the approvals stage, It is getting stuck at the point that approvals should go back out again and I think that is because the change is already approved. Can anyone advised what I add to my UI script that cancels the previously approved approvals so that they can be resent again?

 

Thanks

6 REPLIES 6

That's exactly what we want it to do, go back through the approval process


however when moving back to draft mode its not resetting the approvals.



On 8 December 2014 at 16:28, Michael Ritchie <


marcguy
ServiceNow Employee
ServiceNow Employee

in my experience, you still need to do this via script, you could just put a 'run script' activity to do this, this code is actually in the change request business rule: SNC Approval - Reset conditions



choose from one of the 3 options below:




          // The following options are available for resetting the approvals:


          //


          // 1. Mark all existing approvals for the change as 'cancelled' and restart the workflow to create new approvals


          //             new WorkflowApprovalUtils().cancelAll(current, comment);


          //             new Workflow().restartWorkflow(current);


          //


          // 2. Delete all of the existing approvals for the change and restart the workflow to create new approvals


          //             new WorkflowApprovalUtils().reset(current, comment);


          //             gs.addInfoMessage('Workflow has been reset since key fields have been modified');


          //


          // 3. Leave the approvals for the change in their current state and restart the workflow.


          //       (so that any new approvals that are required will be created)


          //             if (comment)


          //                   current.setDisplayValue('approval_history', comment);


          //             new Workflow().restartWorkflow(current, true);


          //