Since these names are case sensitive you will want to look at the names of your custom entities. Your stock items like AccountSet and ContactSet will be camel cased, but your custom entities will likely show up as new_myentitySet.

If you specify the guid of that entity, the results returned will be for that one entity. All fields are returned whether they are null or not. This listing will show you the exact case of each attribute name that you may want to query.

There are numerous references from MS explaining how to build OData Queries, however, Rhett Clinton’s recent addition to Codeplex is probably the easiest way to generate these queries. His tool can be found at the link below.

To use any of the following in a javascript library as webresource in CRM 2011 solution, you will first need to include a jquery library and a json library. The jquery1.4.1.min.js and json2.js files can be found in the most recent MS CRM SDK. sdk\samplecode\js\restendpoint\jqueryrestdataoperations\jqueryrestdataoperations\scripts. Add these a libraries and include them above the JavaScript library that you put your code in. Click here to see what that looks like in the Forms Property page.

To utilize these OData queries in a CRM Form using JSON, there is a pretty standard template to use. Just set the odataSelect below to your OData select url, and use the appropriate return method.

When selecting what could be any number of entities, there will be an array returned, and you want to look at the data.d.results. When selecting a specific Guid there is no results array created, and you will need to just look at the data.d that is returned.

added some great power to what can be done easily in the JavaScript of a CRM form. This should reduce the number of solutions that require web applications running in iframes dramatically. This is a good thing since MS is phasing out the ISV folder for web applications running in the same app pool on a web server and there is currently no support for aspx files in CRM solutions.

Great post. However, I can't get the data assigned to a field in CRM, no matter what I try. I have use your example to the letter, but the script won't work. I may be missing something on the data.d format. Here is my code:

Thanks Mark,The best post I found. Really great.One question. I have a global variable that I want to set in the ProcessReturnedEntities function during the OnLoad event. I need to use this value to load some aspx pages later. I can put an alert and see that the value is being returned but the value is lost somewhere after the call.

Great post. I struggled to get date fields working and after debugging used:var fieldValue = oneEntity.new_DateTime; var dateValue = new Date(parseInt(fieldValue.replace("/Date(", "").replace(")/", ""), 10));