I am very new to Microsoft Dynamics CRM 2011. I am currently maintaining the CRM system which was developed by someone else. There are custom entities in the CRM. There is one resultset PendingSet which returns rows if I try to execute through OData Query tool
But when I try to view the resultset through the browser using the same URL it returns the blank rows.
Because of blank resultset it shows a javascript OData error in the form.
What can be the reason behind this issue ?
Note : I have viewed the database view. It has records.
Edit : adding the code here. The ajax call below is throwing the error :
function CheckJustification(bag_pendingId, CHANGECASESEVERITY) {
var query = "/bag_pendingSet?$filter=bag_pendingCaseId/Id eq guid'" + bag_pendingId + "' and bag_reasontype/Value eq " + CHANGECASESEVERITY + "";
var justificationexist = ExecuteQuery(query);
return justificationexist;
}
//
// ExecuteQuery executes the specified OData Query asyncronously
//
// NOTE: Requires JSON and jQuery libraries. Review this Microsoft MSDN article before
// using this script http://msdn.microsoft.com/en-us/library/gg328025.aspx
//
function ExecuteQuery(ODataQuery, obj) {
var serverUrl = Xrm.Page.context.getServerUrl();
var justification = true;
// Adjust URL for differences between on premise and online
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
var ODataURL = serverUrl + "/XRMServices/2011/OrganizationData.svc" + ODataQuery;
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: ODataURL,
beforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function(data, textStatus, XmlHttpRequest) {
//
// Handle result from successful execution
//
try {
justification = data.d.results[0].bag_pendingCaseId;
} catch (e) {
justification = false;
}
},
error: function(XmlHttpRequest, textStatus, errorObject) {
//
// Handle result from unsuccessful execution
//
alert("OData Execution Error Occurred");
}
});
return justification;
}