Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Javascript Best Practices

Javascript Best Practices

While Customizing CRM in client side you should follow the below best practices.

scr.jpg

  1. Do not directly edit scripts in script editor window of CRM. Always use Visual studio to edit so that you can figure out the syntax errors properly.
  2. Limit the number of Script libraries your form references. Performance can lag when you view a form for the first time that has multiple scripts. Starting with CRM 2013, scripts are loaded asynchronously and any onload event will fire as soon as the scripts are all downloaded. Additionally, if your OnChange or OnSave events require certain libraries, do not load them with the OnLoad event because of the perceived performance lag.
  3. Remember to collapse all the tabs when you design your forms so that the page can load as fast as possible. All elements inside the sections of the collapsed tabs are not loaded until the tab is opened. There is a TabStateChange event that can invoke your code as needed.
  4. write clean javascript codes with proper comments. Watch this video to understand how to use javascript in CRM.
  1. For cheetsheet for javascript reference card you can download here.
  2. Keep it simple
  3. Use safe and efficient logic
  4. Use non-block queries
  5. Use read-only, unique values

  6. Avoid unsupported code

Below JavaScript features and functions that are unsupported in CRM 2011 are:

  • .getElementById() – Although this method may not fail, it is commonly used for DOM manipulation which is not supported in CRM.  As best practice it should be avoided.
  • JQuery – This powerful JavaScript library provides helper methods that allow developers to do just about anything they want with JavaScript with a very small footprint.  Although it is not officially supported, versions of JQuery are shipped with the Dynamics CRM 2011 SDK The mechanics behind its powerful methods may carry out unsupported actions and therefore result in errors.  Use with caution.
  • crmForm Object Model – This syntax was the official object model of CRM4.0 but is no longer supported with CRM 2011 Update Rollup 12 and newer.  Methods using this syntax are prone to failure in these versions and can fail without producing error messages.
  • .FireOnChange() – Like the crmForm object model, this method has been depreciated.  The .fireOnChange() method (with a lower case ‘f’) is available through the Xrm.Page context and should be used instead.

Follow this link for more info.

You can also get more info about script customization here.

You can enroll now !We are giving 30% discount on our Internship Program

Don’t miss the chance to participate in the upcoming Internship Program which will be done using Microsoft Dot Net Web Development Full Stack Technology. The new batch will be starting from May 20, 2024.  We will have most experienced trainers for you to successfully complete the internship with live project experience.

Why to choose Our Internship Program?

Industry-Relevant Projects
Tailored Assignments: We offer projects that align with your academic background and career aspirations.
Real-World Challenges: Tackle industry-specific problems and contribute to meaningful projects that make a difference.

Professional Mentorship
Guidance from Experts: Benefit from one-on-one mentorship from seasoned professionals in your field.
Career Development Workshops: Participate in workshops that focus on resume building, interview skills, and career planning.

Networking Opportunities
Connect with Industry Leaders: Build relationships with professionals and expand your professional network.
Peer Interaction: Collaborate with fellow interns and exchange ideas, fostering a supportive and collaborative environment.

Skill Enhancement
Hands-On Experience: Gain practical skills and learn new technologies through project-based learning.
Soft Skills Development: Enhance communication, teamwork, and problem-solving skills essential for career success.

Free Demo Class Available