{Dynamics CRM Business Process Flow} Prevent user from moving to previous stage in CRM 2013 Business Process Flows.

In CRM 2013 Business Process flow, the user can move both forward and backward to next stage and previous stage respectively using the Next/ Previous arrows. However sometimes your requirement might be to have process flows unidirectional. In that case you would not want to show the previous arrow shown to the user. Let’s see how you can achieve this using  jQuery.
Following is a business process flow that we have set up for the opportunity entity.
Screen 10


As you can see, we have both the Previous and the Next Stage buttons here.
Let’s how we can hide the previous stage button
In google chrome, using developer tools, we can explore the HTML for the Previous Stage arrow. Following is the HTML that we have.
screen 11
The Id of the Previous stage arrow is stageBackActionContainer. All we need to do is hide this div and increase the width of the “Next stage” div so that it occupies the vacant space using the code below.
function hidePreviousStageButton(stageBackActionContainer, stageAdvanceActionContainer) {
$(“#stageBackActionContainer”).hide();
$(“#stageBackActionContainer”).html(“”);
$(“#stageAdvanceActionContainer”).css(“width”, “90px”);
}
All you need to do is call the hidePreviousStageButton in the onload of the form.
Hope this helps!


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

4 thoughts on “{Dynamics CRM Business Process Flow} Prevent user from moving to previous stage in CRM 2013 Business Process Flows.”

  1. Hi, I disabled both the previous and next buttons. Now I want to increase the width of the last stage. I tried below code but it did not help, please suggest:
    $(“#stage_4”).css(“width: 400px”);

    1. I think there is a small syntax error in jQuery. I think it should be $(“#stage_4”).css(“width”, “400px”);
      Can you try this and let me know if it is working

  2. Hi, this works fine but there’s a short period of time before the form finish loading when the button is still enabled and if the user is quick enough, it can click on it and go to the previous stage. Do you have a workaround for this scenario?

    1. Hi Gabriel,
      Thanks for reading my blog. yeah there is a short span. However the code can only execute with the form load. So not really we can do this to make it faster. I think this risk comes as the peril of this unsupported customization 🙂
      Best Regards
      Debajit

Comments are closed.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading