Wednesday, October 23, 2013

CRM 2013 – Official Microsoft statement for jQuery usage

In the latest documentation you can find the document

Using jQuery with Microsoft Dynamics CRM 2013.docx

In this, Microsoft describes the prefered usage of jQuery in the Microsoft Dynamics CRM context.

Usage in HTML Webresources

Microsoft: When creating user interfaces with HTML web resources we highly recommend that you also use jQuery. It provides many benefits in creating pages that support multiple browsers that it is practically a necessity.

So this is fine and i think everyone is doing this right now.

Usage in Entity-Forms

Microsoft: However, when creating form scripts we do not recommend that you use jQuery. To enforce business logic in forms we provide objects in the Xrm.Page and Xrm.Utility namespaces that you use to apply your business logic within the form. We do not support referencing or manipulating the DOM (including styles) for our pages in any way. …

Ok, i have done this in the past and i don’t want to miss a lot of the jquery functions (ajax….) in the future too. So to make sure you don’t run into big issues try the following.

  • Avoid “hard” CSS/DOM Manipulation via jQuery

Microsoft: We reserve the right to restructure or rename DOM elements in our pages at any time without notice. If your code has dependencies on any objects defined in the DOM and these objects are reorganized or renamed your code will break.

  • Assuming you are not the only one who is delivering solutions for your customer, use the following construct to create your specific jQuery-Object ($).
   1: my$ = jQuery.noConflict(true);
   2: my$.trim("     some text with space     ");

Cheers