none
CRM 2011: Javascript + responsetext: The Data Necessary to Complete This Operation is Not Yet Available

    Question

  • Hi

    I have a custom entity in crm. I want to retrieve multiple records from that entity by querying with name in one of lookup field. Below is the code.

    But I am always getting "The Data Necessary to Complete This Operation is Not Yet Available" in the responseText of 'XMLHttpRequest' object. I think there is some problem with the browser. Readystate is not changing from 1 to 4. It always stops at 1.

    Can anybody help me with solution? 

    function Getdata() {
        var serverUrl;
        var Url;
        var tableEndpoint;
        var query;

        serverUrl = Xrm.Page.context.prependOrgName("/XRMServices/2011/OrganizationData.svc");
        tableEndpoint = "/new_key";
        query = "?$filter=new_grpid eq 'xxxxx'";
        Url = serverUrl + tableEndpoint + query;
        
        var retrieveSettings = new XMLHttpRequest();
        retrieveSettings.open("GET", Url, true);
        retrieveSettings.setRequestHeader("Accept", "application/json");
        retrieveSettings.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        retrieveSettings.onreadystatechange = function () {
                RetrieveCallBack(this);
        };
        retrieveSettings.send();
    }

    function RetrieveCallBack(retrieveSettings) {
        if (retrieveSettings.readyState == 4 /* complete */) {
            if (retrieveSettings.status == 200) {
                var result= this.parent.JSON.parse(retrieveSettings.responseText).d;
                        }
        }
    }

    Any help will be highly appreciated.

    Regards

    Wednesday, June 20, 2012 1:48 PM

All replies

  • Hello,

    First thing I see that you use name of entity. Set key word should be used. Recheck following - http://technet.microsoft.com/en-us/library/gg334427

    And in common - you should recheck syntax of your query using following tool - http://crm2011odatatool.codeplex.com/


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter

    Wednesday, June 20, 2012 1:56 PM
    Moderator
  • Hi Andrii

    That was a typo error. Entityname is specified as new_keySet and syntax is also correct.

    But still the problem persists. 

    Regards

    Wednesday, June 20, 2012 2:09 PM
  • Hello,

    Could you please insert after line

    Url = serverUrl + tableEndpoint + query;

    line

    alert(Url);

    and post it here? I believe that something is incorrect inside.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter

    Wednesday, June 20, 2012 2:38 PM
    Moderator
  • Hi Andrii

    Please note: "/Standard/XRMServices/2011/OrganizationData.svc/new_keySet?$filter=new_grpid eq 'Credit Check'"

    Regards

    Wednesday, June 20, 2012 2:52 PM
  • Based on the name new_grpid I can assume that this is field of EntityReference or id field. In this case you will have to use ide of correspond level and not display name for this record. So your Url should look like

    "/Standard/XRMServices/2011/OrganizationData.svc/new_keySet?$filter=new_grpid eq guid'86672FD6-CBDC-4BFE-AA56-EDAF98CDCF9F'"

    Of course value 86672FD6-CBDC-4BFE-AA56-EDAF98CDCF9F should be replaced with proper id of the record.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter

    Wednesday, June 20, 2012 2:59 PM
    Moderator
  • Hi Andrii

    I want the data from 'key' entity on the onload of another entity A (there is no relationship between the A and key).

    So I have found somewhere that it is possible to retrieve data by querying with the name present in the lookup field.

    Please guide.

    Regards

    Wednesday, June 20, 2012 3:08 PM
  • Hi

    I am simply calling below function but still getting the same issue.

    function Getdata() {
        var retrieveSettings = new XMLHttpRequest();
        retrieveSettings.open("GET", "/Standard/XRMServices/2011/OrganizationData.svc/AccountSet(guid'3852C75A-B28A-E111-AC85-002655878919')", true);
        retrieveSettings.setRequestHeader("Accept", "application/json");
        retrieveSettings.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        retrieveSettings.onreadystatechange = function () {
                RetrieveCallBack(this);
        };
        retrieveSettings.send();
    }

    function RetrieveCallBack(retrieveSettings) {
        if (retrieveSettings.readyState == 4 /* complete */) {
            if (retrieveSettings.status == 200) {
                var retrievedUser = this.parent.JSON.parse(retrieveSettings.responseText).d;
                        }
        }
    }

    Still getting  "The Data Necessary to Complete This Operation is Not Yet Available" in the response text.

    Please help.


    Regards Karan Mittal

    Thursday, June 21, 2012 10:26 AM
  • Hi 

    Whenever I try to query some data from CRM database using javascript, I always stuck with the "The Data Necessary to Complete This Operation is Not Yet Available" in the response text of the xmlhttpobject. readystate being 1. Is there any browser issue or browser settings, I have to work with? Facing this problem a lot.

    For reference, I have used the following code in onpremise deployment and got the error.

    function Getdata() {
        var retrieveSettings = new XMLHttpRequest();
        retrieveSettings.open("GET", "/Standard/XRMServices/2011/OrganizationData.svc/AccountSet(guid'3852C75A-B28A-E111-AC85-002655878919')", true);
        retrieveSettings.setRequestHeader("Accept", "application/json");
        retrieveSettings.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        retrieveSettings.onreadystatechange = function () {
                RetrieveCallBack(this);
        };
        retrieveSettings.send();
    }

    function RetrieveCallBack(retrieveSettings) {
        if (retrieveSettings.readyState == 4 /* complete */) {
            if (retrieveSettings.status == 200) {
                var retrievedUser = this.parent.JSON.parse(retrieveSettings.responseText).d;
                        }
        }
    }

    Anybody please help.


    Regards Karan Mittal

    Thursday, June 21, 2012 10:41 AM
  • Try to change line

    retrieveSettings.open("GET", "/Standard/XRMServices/2011/OrganizationData.svc/AccountSet(guid'3852C75A-B28A-E111-AC85-002655878919')", true);

    to

    retrieveSettings.open("GET", "/Standard/XRMServices/2011/OrganizationData.svc/AccountSet(guid'3852C75A-B28A-E111-AC85-002655878919')", false);


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter

    Thursday, June 21, 2012 11:01 AM
    Moderator
  • Hey Andrii

    Its working fine when I changed it to sync operation that is true to false.

    There is some problem when I did it asynchronously. and I feel like there is some browser issue.

    Any idea.


    Regards Karan Mittal

    Thursday, June 21, 2012 11:35 AM
  • Hey Andrii

    Its working fine when I changed it to sync operation that is true to false.

    There is some problem when I did it asynchronously. and I feel like there is some browser issue.

    Any idea.


    Regards Karan Mittal

    Actually this is what I've suggested.

    Regarding issue - you can try to google (actually in this way I have found an answer).


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter

    Thursday, June 21, 2012 11:38 AM
    Moderator
  • It means temporarily issue can be resolved by calling the crm service asynchronously

    But there is no permanent solution to this async call to crm service.


    Regards Karan Mittal

    Thursday, June 21, 2012 11:44 AM
  • Hi Andrii

    Request you to please check my code.

    I hope there is no problem with the code.


    Regards Karan Mittal

    Thursday, June 21, 2012 11:51 AM