Saturday, March 10, 2012

jQuery Web Resource in CRM 2011

First off, head over to the jQuery website and hit the big download jQuery button to get the latest, compressed version. It might open the script file in your browser window, so you will need to “Save Page As…” to actually get a copy in a file we can use in CRM.
Next thing, go to “Settings” –>”Customizations” –> “Customize the System” in CRM. From there pick “Web Resources” from the left hand navigation.
jQuery1
Select “New” from the top of the grid so we can add the jQuery file. Enter the “name” field to which will server as the identifier for the file – it will append your prefix for the Default Publisher to the beginning. It would also be a good idea to set the “Display Name” to something you can easily identify as well the the “Description” (note the version number of jQuery perhaps?). Both of these fields will show up in your view that lists all of the resource files and then can be sorted on so you can more easily find what you are looking for. From the “Type” drop down list select “Script (JScript)” and for “Uploaded File”, browse to the file you downloaded and saved. “Save and Close” and you should be all set.
jQuery2
Now when you want to use jQuery in any of your Form scripts, be sure and add it before the resource file that contains the references to jQuery in the libraries that are available to the Form (Form Properties). Once you’ve done that, you should be in business.