Business Process Flow is a great feature in CRM 2013.

But, sometimes, in some condition or simple situation, customer does not need this Business Process Flow, so we should hide it in certain conditions. You can enable or disable Business Process Flow by adjusting the security role, but, what if you want to hide the Business Process based on field value, form type, or selected form?

For example, I want to hide the Business Process Flow based on this field:

image

Once the ‘Show BPF’ field is checked, then I should Show the Business Process Flow, and vice versa, I should Hide it if this fields is unchecked.

*You can have your own scenario and certain condition, this is just one of the example.

So, here is the code:

function hideBusinessProcessFlow()
{
document.getElementById('header_process_d').style.display = "none";
}

function showBusinessProcessFlow()
{
document.getElementById('header_process_d').style.display = "block";
}

function showHideBusinessProcessFlow()
{
if (Xrm.Page.getAttribute("new_showbpf").getValue() == true)
{
showBusinessProcessFlow();
}
else
{
hideBusinessProcessFlow();
}
}

Then, as usual, register the showHideBusinessProcessFlow() function in the onChange Event Handler of the ‘Show BPF’ field.

And test the result:

*Checked

image

*Unchecked

image

NB: This is unsupported Customization, and you might be aware during the version upgrading I the future.

For your additional information, to switch or change the Business Process Flow Process and Stage programmatically, you should refer to this great link:

http://develop1.net/public/post/How-to-change-process-and-stage-programmatically.aspx

Hope it helps!
Thank you and God Bless You!