Translate

Sunday, 20 April 2014

How to increase the performance of crm form

Hello CRM Lovers,
         
   Many times we see that crm form takes much time to load, this is really hectic. Every one wants smooth processing of crm. So we have to take care of the thing by which crm perform well.

  Slow processing may be due to fallowing reasons, slow internet, less ram and java scripts on crm form. Improper java scripts code is also a bigger reason for slow processing of crm form.

  In this post of mine I am going to describe about best practices for use of java script code.

These are some things you should remember before using java script on crm form.

1. Do not include unnecessary java script web resource library :-

As we know if any web page contains more script to include on page load, page will take more time to load, so the more scripts you add to the form, the more time it will take to download them. After loading first time scripts get cached in browser. But as we usually say first impression is the last impression, so we have to try to not include unnecessary web resource library on crm form.

For a example, don’t include jQuery in your form scripts simply because if you want to use XMLHttpRequests. While jQuery has the $.ajax function that many people are familiar with to perform these requests, it is a developer preference, not a necessity. It is possible and better also to perform these requests using the native XMLHttpRequest object found in all browsers supported by Microsoft Dynamics CRM.

2. Try to avoid loading all scripts in the Onload eventof the crm form :-

If you have code that only supports OnChange events for fields or the OnSave event, make sure to set the script library with the event handler for those events instead of the OnLoad event. This way loading those libraries can be deferred and increase performance when the form loads. We do not recommend using the addOnChange method within the OnLoad event handler simply as a matter of convenience. While this may reduce the number of steps necessary to add your event handlers, it causes the form to load more slowly.

3. Use collapsed tabs to defer loading web resources :-

Here is one intresting thing whenever a web resources or IFRAMES are included in sections inside a collapsed tab, they will not be loaded if the tab is collapsed so the script will also not get loded on page load. They will be loaded when the tab is expanded. When the tab state changes, the TabStateChange event occurs. Any code that is required to support web resources or IFRAMEs within collapsed tabs can use event handlers for the TabStateChange event and reduce code that might otherwise have to occur in the OnLoad event. So we we have to think and decide which code should written on Onload event of the crm form.

4. Try to set default visibility options :-

We have to use default functionality for hiding attributes, We should avoid to use form scripts in the OnLoad event to hide form elements. Instead, set the default visibility options for form elements that might be hidden to not be visible by default when the form loads. Then, use scripts in the OnLoad event to show those form elements you want to display.

Enjoy the great technology Dynamics CRM. Good luck.

Post a Comment