I am trying to make an Ajax call from MSCRM (My CRM Deployment is with Update Roll up 14 on OS SQL Server 2012). My function reaches in "I am Success" alert but than on next alert I receive error
--------------------------- Message from webpage ---------------------------
An error has occurred.
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
--------------------------- OK ---------------------------
Following is my code:
function retrieveSelectedRecord(accountId) {
var select = "&select=Name,accountId";
var filter = "&filter=AccountId eq guid'" + accountId + "'";
var oDataSelect;
oDataSelect = "/XRMServices/2011/OrganizationData.svc/AccountSet?" + select + filter;
jQuery.support.cors = true;
$.support.cors = true;
$.ajax({ type: "GET",
contentType: "application/json;
charset=utf-8", datatype: "json",
url: oDataSelect, beforeSend:
function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest)
{ // Use for a single selected entity
alert("I am in Success");
alert(data); ProcessReturnMsg(data.d); },
error: function (xmlHttpRequest, textStatus, errorThrown)
{
alert("I am in Error");
alert("Status: " + textStatus + "; ErrorThrown: " + errorThrown); }
});
}
function ProcessReturnMsg(entity) {
var name = entity.Name;
alert(name);
//Xrm.Page.getAttribute("uomid").setValue(defaultuomid);
}