POWEROBJECTS

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

Send us a message

Are you using an out-of-the-box Business Process Flow in Microsoft Dynamics CRM 2013 or 2015, but want to have it collapsed by default? Then today we have the answer for you! Business Process Flows are tools that help guide users through business processes in CRM. However, if your organization doesn’t wish to utilize the built-in Business Process Flow, simple JavaScript is all that is needed to collapse them.

tips-and-tricks

In this example, we will show the steps for collapsing the Business Process Flow on the Opportunity record. The following JavaScript must be placed in the OnLoad event on the Opportunity form:

function collapseOpporBusinessProcess(){setTimeout(collapseOpporBusinessProcessDelay,300)}

function collapseOpporBusinessProcessDelay(){Xrm.Page.ui.process!=null&&Xrm.Page.ui.process.setDisplayState(“collapsed”)}

Here are the step-by-step instructions for deploying custom JavaScript in Dynamics CRM. Please note before getting started that you will need the appropriate permissions and the System Administrator or System Customizer role may be required. .

Step 1:    Launch Form Editor for the Opportunity record, then click on Form Properties from the ribbon.

Collapse Business Process Flows

Step 2:    Add a New Library by clicking Add in the Form Properties section.

Collapse Business Process Flows

Step 3: When a dialog box is presented, on the bottom left, select New to create a new web resource.

Collapse Business Process Flows

Step 4: Provide an appropriate Name and Display Name. From the Type selection, choose Script (Jscript), then click Text Editor.

Collapse Business Process Flows

Step 5:    Paste in the following code.

function collapseOpporBusinessProcess(){setTimeout(collapseOpporBusinessProcessDelay,300)}

function collapseOpporBusinessProcessDelay(){Xrm.Page.ui.process!=null&&Xrm.Page.ui.process.setDisplayState(“collapsed”)}

Collapse Business Process Flows

Click OK. Save, Publish and Close the newly created Web Resource. CRM returns you to the Web Resource Look Up dialog window.

Step 6:    Click Add to add the newly created Web Resource to the Form Library.

Note: if the new web resource is not already selected you may search for it again as shown here.

data:text/mce-internal,content,%3Cimg%20src%3D%22http%3A//www.powerobjects.com/wp-content/uploads/2015/06/062315_1704_CollapsingB6.png%22%20alt%3D%22%22%20/%3E

Step 7:     Now scroll down to the Event Handler section on the Form Properties window. Ensure the Control is set to Form and Event is set to OnLoad, then click Add.

Collapsing Business Process Flows

Step 8:    On the Handler Properties window, paste in the Function Name, collapseOpporBusinessProcess, and click OK.

Collapsing Business Process Flows

Step 9: On the Form Properties window, click OK, then on the Opportunity Form, click Save and Publish.

Collapsing Business Process Flows

Now you are all set! You will now see that the Business Process Flow will be collapsed. You may see if for a brief period immediately following the above steps due to timeout settings in the code. This is required in order to allow the entire form to load (including sub-girds and other elements). The out-of-the-box expand/collapse functionality will still remain in place.

Collapsing Business Process Flows

That’s all for today, folks. For additional tips and tricks, visit our blog weekly. You can also find more information regarding Business Process Flows in CRM 2015 here. And as always, if you need additional assistance with Dynamics CRM, don’t hesitate to reach out to us here at PowerObjects.

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.