Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 13977

Collapsing Business Process Flows in Dynamics CRM 2013/2015

$
0
0

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.

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.

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

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

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

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

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.

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.

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

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

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.

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!

 


Viewing all articles
Browse latest Browse all 13977

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>