Search code examples
dynamics-crm-2011odata

Resultset returns blank rows Microsoft Dynamics CRM 2011


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

enter image description here

But when I try to view the resultset through the browser using the same URL it returns the blank rows.

enter image description here

Because of blank resultset it shows a javascript OData error in the form.

enter image description here

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;

}


Solution

  • It looks like the web browser is returned results its just trying to incorrectly display them as an RSS feed.

    Open; Internet Options > Content > Settings > "Turn on Feed Reading View" to off.

    When you try browsing for the results you should now get an Atom feed of your data.

    There is probably something wrong in your JavaScript in which case the best way to analyse the issue is to open the Debugger (F12) and step through the code to find the issue.