Showing posts with label Speedup CRM Forms. Show all posts
Showing posts with label Speedup CRM Forms. Show all posts

Friday, June 19, 2015

Common reasons for slow form loading in MS CRM

The main reason of slow loading forms are
Busy Javascript onload functions
Too many subgrids
Lots of oData/fetchXML queries
Tabs, sections and fields not needed on the form
bad/slow coding
We had our list of worst performing forms and we had a quick look at them and made some quick notes
How many unfiltered OData retrieves
How many OData calls, where they retrieving the same set
Number of ribbon buttons
potential fields/functionality which could be removed by change of business process
size of Javascript onload function

Finding the Slow Forms
Fiddler
One of the tools I used to analyize the slow loading CRM forms was fiddler.  I wrote a blog post about Getting Started with Fiddler and CRM.  It’s a great tool to see what calls are being made from the page, how long they took and how much data they were bringing back.
Looking at the fiddler logs I was able to investigate the OData queries and find
Which OData calls took the longest
Find OData calls which were not filtered
Find OData calls which were retrieving the same data multiple times
general loading times of sections of code
F12 Debugger
The F12 debugger is such an awesome tool for debugging Javascript.  I put in a break point in the onload Javascript and walked through the code.
We are using two main methods to find slow loading code
Looking at the code
Stepping through the code

How to speed up form loading
In some of the forms we were retrieving fields from related entities but to speed up the form the customer was happy to use lookups and click those for more information if it was needed.   This saved OData queries
These changes can remove some of the code triggered on the Javascript onload.
Improvements can come from moving fields and subgrids into unexpanded tabs where the loading can be delayed until the tab is expanded
Remove unwanted/unused fields
CRM Developers have to refactor their code then I think CRM Forms and entities should be refactored to remove the noise of unused fields.
There is a great tool to help you with this called CRM Data Detective it will show you what fields are being used/not used by seeing if any values were written to those fields.  The CRM Data Detective is a free tool which works with CRM 2011 and CRM 2013.