I am trying to get data from CRM 2011 through jQuery but I am unable to fetch the data. Here is my code:
function GetConfigurations() {
var oDataPath = Xrm.Page.context.getServerUrl() + "/xrmservices/2011/organizationdata.svc";
var filter = "/new_plugins_configurationSet?" +
"$top=1";
var dataUrl=oDataPath + filter;
alert(dataUrl);
try
{
$.ajax({url: dataUrl, success: function(result){
alert(result);
},error:function(error){console.log(error);alert("error");}});
}
catch(err)
{
alert("error" + err.message);
}
}
This gives me the following error in the console of the CRM form:
Am I doing something wrong in the code?
Edited :
I have done changes in Js Code and now I am writing new_plugins_configurationset but it is returning Cross origin error even tough I am calling JS Code from CRM forms.
Here what I want to achieve is that on opening of one Entity CRM form, I want to read a second entity and put value in control of opening entity. that's why I am calling second entity using JS code.
async: false
which needs to be removed. I'd suggest you check the network tab of the console after making the request to see what the response code and text is. If the request is failing it should hopefully give you a useful error message you can debug – Rory McCrossan