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

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

4 Responses to Prevent user from moving to previous stage in CRM 2013 Business Process Flows.

  1. Rabison says:

    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”);

    • Debajit says:

      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. Gabriel Salazar says:

    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?

    • Debajit says:

      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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: