Just sharing the sample code to make synchronous OData call in CRM 2011.
var oDataRequestUrl = http://server/orgname/xrmservices/2011/OrganizationData.svc/ContactSet?$select=FullName
var result = syncODataCall(oDataRequestUrl);
// function to make synchronous oData call
function syncODataCall(odataSelect) {
var request = new XMLHttpRequest();
request.open("GET", odataSelect, false);
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=utf-8");
request.send();
var objJQuery = jQuery.parseJSON(request.responseText);
return objJQuery.d
}
Check for following methods to parse the result returned
- ProcessReturnedEntities(data.d.results)
- ProcessReturnedEntity(data.d)
http://crmscape.blogspot.in/2011/03/crm-2011-odata-json-and-crm-forms.html
Hope it helps !
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.
