Form programming is an unavoidable feature when we are building a user interactive CRM solution. Any feature will be user friendly when it performs better. To make sure our forms are more user friendly and are performing better make sure we follow some of the recommended best practices.
Avoid including unnecessary JavaScript web resource libraries
Each time when we add a web resource to a form, the system will try to load the same when the form gets loaded. So make sure only much required web resources are included in the form load. Most often this is not an issue as the system caches the scripts when the forms are loaded for the first time. First impression is the best, so lets make sure even in the first time the forms are performing as expected.
Avoid loading all scripts in the Onload event
We most of the developers has a bad habit of loading everything in OnLoad and keeping it ready for future reference. This might be just for our convenience and nothing else. If a web resource only has code that supports OnChange event for fields or OnSave event, its always better to defer the loading of web resource for a later time which will increase performance of loading the form. Its never recommended to use the addOnChange method within the OnLoad event handler simply as a matter of convenience. Sometimes the only benefit of doing the stuff would be to reduce the number of steps to add event handlers, it causes the form to load more slowly.
Use collapsed tabs to defer loading web resources
Tabs in CRM will have web resource or IFRAMES for several purpose and will be loaded when the tab is expanded. So its always recommended to keep the tabs collapsed which have such web resources or IFRAMES thus deferring the records from being loaded unnecessarily during the form load. These can be loaded using the even handler for TabStateChange event and reduce code that might otherwise have to occur while OnLoad event.
Set default visibility options
Use the out of the box features in CRM to make an element visible or invisible by default. Unnecessary moving this logic to script will only delay the form loading process.
Again these are not hard core rules. Just keep them in mind to make sure wherever we can implement to do so. It again all depends on business requirements. Finally its all for custom business scenarios 🙂
What is the best way to reach you
LikeLike
You can reach out to me via email @ renjithpradeep@gmail.com
LikeLike