Home > CRM 2011, JQuery > How to add JQuery support to CRM 2011?

How to add JQuery support to CRM 2011?

Last night I spent couple of hours trying to debug a JQuery code in MS CRM 2011 which was not working as expected. After debugging I realized that JQuery native support is not available in microsoft CRM 2011. This was the exact reason why the Javascript was unable to recognize ‘$’ symbol and ribbion stopped showing on CRM 2011 page.  The easiest way to get this working is by creating a web resource and adding Jquery min file to it.

Do the following

  1. Go to http://jquery.comand then to Download
  2. find the latest Jquery min (select the minified version, at the time of writing http://code.jquery.com/jquery-1.6.1.min.js was the latest)
  3. Now go to CRM 2011 and create a web resource
  4. Add the new Web resource by name JQueryMin1.6.1 (JQuryMin<Verion>)
  5. Upload the Downloaded file to JQuery to this web resource.
  6. Now add this web resource to which ever form you want to use JQuery api

Hope this helps.

Categories: CRM 2011, JQuery Tags: ,
  1. Bidhan Chakraborty
    July 15, 2011 at 6:19 am

    Hi Devashish,
    i have tried adding the latest JQuery-1.6.1.min.js file and added a web resource for that. when i use the folloiwng code on the custom entity’s onload i do get error of Object not define. and the error resided on the $.ajax line of the folloiwng code block

    function getProviderName(providerID) {
    // Set Global Variables
    var context = Xrm.Page.context;
    serverUrl = context.getServerUrl();
    ODataPath = serverUrl + “/XRMServices/2011/OrganizationData.svc”;

    // here i’m passing lookup guid as parameter to retrieve that lookup entity related information
    var entityName=”Account”;
    var selectClause= “?$select=Name,fuj_ProvderApprovalNumber”;

    function retrieveSelected(entityName,entityRecordID,SelectClause) {
    var entity =entityName;// “Product”;
    var select =SelectClause;// “?$select=ProductId,DefaultUoMId,ProductNumber”
    var oDataSelect;

    // build query string
    oDataSelect =ODataPath + entity + “Set(guid'” + entityRecordID + “‘)” + select + “”;

    type: “GET”,
    contentType: “application/json; charset=utf-8”,
    datatype: “json”,
    url: oDataSelect,
    beforeSend: function (XMLHttpRequest)
    XMLHttpRequest.open(“GET”, oDataSelect, true);
    XMLHttpRequest.setRequestHeader(“Accept”, “application/json”);
    XMLHttpRequest.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
    success: function (data, textStatus, XmlHttpRequest) {
    // Use for a single selected entity
    // ProcessReturnMsg(data.d);
    error: function (xmlHttpRequest, textStatus, errorThrown) {
    alert(“Status: ” + textStatus + “; ErrorThrown: ” + errorThrown);


  2. July 25, 2011 at 3:05 am


    Sorry for replying late. Your problem is a strange one. if you can answerer me some questions I will be able to answerer it more properly

    1) Have you included JQuery resource in page onload event?
    2) If yes may be the Jquery file might be incorrect. Please try updating the Jquery webresource. I had this problem once.
    3) If you are using JSON parsing remember JSON uses a different javascript library by name JSON2.js
    4) Please use IE script debugging tool to get the exact error and line


  3. Daniel
    September 16, 2011 at 7:12 am

    very useful script. When i try to get regardingobjectid of the parent entity I’m getting Access Denied error. Any ideas?


    • March 1, 2013 at 10:48 am

      Thank you for appreciating our blog.
      Are you using webresource? Have you enabled cross frame scripting?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: