- In one of my CRM 2011 requirement, I had to update a record using ribbon button placed on CRM grid.
- I had written an update script which calls OData service using Json & JQuery. (link)
- But when I execute the function, I got “$ undefined” exception.
- I wondered since I already had “Json.js” & “JQuery.js” web resources added to my entity.
- After digging deeper, I came to know that, “JQuery.js” web resource is not getting loaded when my ribbon button’s function handler fired.
- I fixed the problem by loading “JQuery.js” web resource dynamically, before I call my update method.
- Below is the script to load the web resource’s
var JScriptWebResourceUrl = “../WebResources/new_JQuery”;
var xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
xmlHttp.open(“GET”, JScriptWebResourceUrl, false);