{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!

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s