POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

The business process flows that were introduced with CRM 2013 are a great way to walk a user through a specific process, related to an entity in Microsoft Dynamics CRM. However, there are times when a business process flow is useful for one team, but maybe not for another. What if, for example, you have a general account form for the entire team, but then a separate account form for the billing team? A business process flow that walks you through creating a support agreement for the account might be useful for the users who use the general account form, but maybe not for the billing team. Luckily, there is a quick and easy way to hide the business process flow, using some basic JavaScript.

crm-2015

First, you’ll want to create a two option type field that you will set if you’d like to hide the business process flow. In my case, I’ve created a field called “Hide BPF”, and set the default value to “Yes”.

Setting Visibility of a Business Process Flow with JavaScript in Dynamics CRM 2015

Next, place the field on the form that you’d like to hide the business process flow on. Note that the JavaScript listed below only runs when the field is on the form, and will hide the BPF when the field is either blank or true (yes). So what you could do is place the field on the form in an “administrator” section, or something similar, as a read-only field. That way, the field will always be blank or yes, and no one can change it, which means that any form this field is on, will hide the BPF.

After you’ve created the “Hide BPF” field, create a web resource containing the JavaScript to hide the business process flow. When you create the web resource, name it appropriately, and paste the following JavaScript into the web resource content.

 

function hideBusinessProcessFlow() {

Xrm.Page.ui.process.setVisible(false);

}

 

function showBusinessProcessFlow() {

Xrm.Page.ui.process.setVisible(true);

}

 

function showHideBusinessProcessFlow() {

if (Xrm.Page.getAttribute(“po_hidebpf”).getValue() == false) {

showBusinessProcessFlow();

}

else {

hideBusinessProcessFlow();

}

}

 

Then, navigate to the form where you’d like to hide the business process flow and navigate to the form properties, within the form customizations. Add the form library (web resource you created in the last step) and create a new Form OnLoad event, that calls the function above.

Save and publish your customizations. Now, when users are using this form, the business process flow will be hidden.

Setting Visibility of a Business Process Flow with JavaScript in Dynamics CRM 2015

Whereas on forms where this field is not used, the business process flow will show as expected.

Setting Visibility of a Business Process Flow with JavaScript in Dynamics CRM 2015

Credit: Thank you for Ms. Dynamics CRM for the article, which helped get this blog together.

Make sure to stop by our main blog page for even more Dynamics CRM fun! Or if you are interested in learning more about CRM 2015, we have an entire page dedicated to bringing the latest and greatest information to you!

Happy CRM’ing!

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.