Hi, I am facing an issue on the change stage of BPF.

My scenario is: I'm making an approval process using BPF. So I want to move stages and update BPF accordingly. So for instance, there are 2 Persons involved in the approval process. Person A and B. Now if A approves (approval is an option set) then the stage moves to the next stage and Person B is now responsible for the approval. Now if person B rejects, then the stage would reset to the starting stage i.e. person A's stage. Now the problem is, we are setting the active stage after checking if the person B's approval optionset is set to rejected, and then saving the form explicitly. So what it does now is we have to click 2 times in order to make the expected change. We are doing this in JS and using addOnPreStageChange() and we are preventing the default behavior which moves it to next stage. Kindly refer to the code and screenshots below for better understanding.


function HideStageButton(executionContext){
    var formContext = executionContext.getFormContext();


function StageChange(executionContext){
    var direction = executionContext.getEventArgs().getDirection();

///--->For Rejected Stage----------->

        Xrm.Page.data.process.setActiveStage("10ae7c3e-4613-4b30-be9b-894c82c8c0e9", ()=>{console.log("Hello world")});
For Person A
For Person B