How to stop/prevent a workflow from skipping an approval level.

priyankamodak
Kilo Contributor

Hello,

I have a requirement to cancel the approvals when a Change Request is moved to rework state so that no approver can approve it while it is in rework. I have been able to cancel the approval records but once they are cancelled the change request approval workflow is skipping the current approval level moving to the next workflow activity.

For example, suppose the Change was awaiting Manager's approval and the state was submitted. When I am running the code to cancel the existing approval records while setting the state to rework, on update the workflow associated with the change is skipping the 'Manager approval' giving result as true (approved) and moving to the next activity that is 'Director approval'. Hence, making the CR in 'Awaiting Director Approval' state and new approval requests triggered instead of being in 'Rework' state.

Can I please get some suggestion here as how to go with this?

Many Thanks in advance!

3 REPLIES 3

rlatorre
Kilo Sage

What version are you running?



Try setting the State of the approvals to "Not yet requested" instead of cancelling them. I beleive the workflow will change them back to "Requested" when the activity they are related to is run.


Thanks Robert.



I have cancelled the workflow to prevent it from moving further to the next approval level and this is working fine as per the current workflow design and our requirments, which I was afraid won't.


However, your suggestion to mark the approvals as Not yet requested rather than cancelling them sounds helpful. I will surely give it a try, thanks!



That regarding the rollback activity, we have already used it in the workflow, if required I can manage to reuse the activity to trigger the approval again. Actually I am avoiding making any changes to the workflow.



Best Regards!


rlatorre
Kilo Sage

Are you using the roll back activity?



Rollback To



The Rollback To activity transitions to an earlier activity. The Rollback To activity updates all activities that executed between the Rollback To activity and the transitioned to activity.



Use this activity to revert the workflow to an earlier activity. Approvals are reset to 'Requested', and tasks are reset to 'Open' or 'Pending'.



The activity state tells the workflow engine how to handle the record being executed. Possible state values are:


*Executing: the workflow engine starts the 'run' function of the activity.


*Waiting: the workflow engine ignores the activity until a specific event to restart the activity is fired.


*Finished: the activity finished running. See the result value for the outcome of the activity.


*Cancelled: this activity, or the workflow that contains this activity, was canceled.


*Error: a JavaScript error occurred. Review the logs for error details.



Keep in mind:


*The Rollback To activity does not reset Manual Approval activities. When a workflow moves through a Manual Approval activity again, the workflow automatically sets the approval state based on the existing value. Placing a Manual Approval activity directly before a Rollback To activity causes a loop.