5 Ways to Enhance Performance on a Dynamics 365 for Sales (CRM) Form with Hundreds of Custom Attributes
If your Microsoft Dynamics 365 for Sales (CRM) implementation has forms containing hundreds of custom attributes, you might notice some performance issues. These issues can be easily addressed in a few simple steps. This blog provides some helpful tips and strategies to help improve performance.
Case Study: An Opportunity Form with 200+ attributes suffers due to missteps during the Design phase
This organization had an Opportunity form with more than 200 custom attributes, and it was projected that the form would need to be further expanded, with even more attributes. As the testing phase began, the impact the large number of attributes had on the form’s performance became painfully obvious. The likely reason for this was that performance factors were not taken into consideration before beginning the design and configuration phase. Below are five performance enhancing improvements we addressed:
The Opportunity Form
The Opportunity Form in question included the following:
- Out-of-the-box attributes wherever possible
- 100+ Custom attributes for data entry and displaying incoming data
- 80+ hidden attributes for various background processing
- 30+ Quick View forms for ease of access to information from related entities and all 1:1 relationship records. A summary stage was included in the business process flow with all forms to provide an overall summary of the Opportunity to the user
- 10+ sub grids to add related information directly from the main form
- A small number of Business Process Flows (BPF) that switch in an automated fashion depending on the stage of Opportunity in the process. We also used XRM.Page.data.process methods for automating the movement of BPF to remove manual intervention wherever possible.
- 10+ custom ribbon buttons that show/hide based on the Opportunity Stage and helps with custom features like:
- Opening PDF reports
- Show/Hide sections of the form
- Refresh calculations
- Move stages between BPF
- Open html hierarchy
- 3,500+ lines of Form Script, plus an internal common scripts library. 1,000+ on the Form load alone
- 100+ business rules/synchronous/background processes
1. Form improvements – Reduced load and save timings up to 10%
- Collapsed all subgrids on load
- Show/hide subgrids that are absolutely necessary based on the stage
- Split entity into multiple entities and link with 1:1 relationship, primarily to avoid having too many fields in a single form and the second is to make sure that the maximum allowed attributes of 1024 is not reached (an SQL restriction that can be reached quickly, especially with following data types consuming more than 1 column in SQL server table: Look ups -3, Money/Boolean/Option Set – 2)
- Hide all unused out-of-the-box ribbon buttons
- Reduced the number of Web API Calls as much as possible
- Using global variables to store retrieved columns and reuse across the form
- Combining API calls to Retrieve/Update data
NOTE: This is one of the primary factors that helped improve overall performance and reduce automated stress test timings.
- Using Fiddler to track and measure the timeline of API calls helped with monitoring each improvement’s effect as well as impact of improvements. Download Fiddler
- Set code to run Web API calls asynchronously wherever possible
3. Plugin improvements – Reduced Save times up to 40%
The following can be set inside the Plugin Registration Tool that comes with the Dynamics 365 (CRM) Software Development Kit:
- Make sure to use filtered attributes on Plugin steps and retrieve only required attributes
- Set Plugin Steps to run asynchronously, wherever possible. This made a huge improvement and reduced the time to save records up to 50% in some cases.
- Additionally, the feature that allows you to search plugin steps with Ctrl + F inside plugin registration tool is very helpful
Following are some recommended code improvements:
- Avoid selecting all columns via Microsoft Dynamics 365/CRM query APIs
Entity caseEntity = (Entity)service.Retrieve(caseEntityRef.LogicalName, caseEntityRef.Id, new ColumnSet(true)); //Not good to select All Columns
Entity caseEntity = (Entity)service.Retrieve(caseEntityRef.LogicalName, caseEntityRef.Id, new ColumnSet(“aka_originalpricinganalyst”, “aka_casestarted”)); //Best practice is to select specific attribute
- Do not retrieve the primary entity in Microsoft Dynamics 365/CRM plugins.
4. Process improvements
- Convert all possible synchronous workflows to run as background workflows
- Delete all succeeded jobs upon completion to alleviate the growth of System Jobs
NOTE: The System Job size can also have a huge impact on the performance of running Workflows and creates a higher cost if the size of the instance grows past your allotted storage space.
5. Infrastructure improvements
- The team implemented AKA’s best practice hardware configuration and performance testing standards in this environment, which is in addition to Microsoft’s recommendations. If you are interested in learning how we can help improve your overall hardware performance, contact AKA.
In short…thorough initial design is the key
The importance of thorough initial design considerations is paramount when it comes to ensuring a well-designed and user-optimized experience. Many of the topics above will help improve the overall performance of the form load and provide a better experience to users who—let’s face it—expect their system to be fast so they can improve their overall performance as well.
If you have questions about this or need other technical advice on Microsoft Dynamics 365, contact the CRM experts at AKA Enterprise Solutions.