locked
OData data error Syntax error '$' at position 4. RRS feed

  • Question

  • Hi there,

    I'm using OData to get phone number on Task screen. Its working fine but suddenly it showing an error. I did not understand why now this error occur because thousands of Tasks created against the records.

    Server: MSD CRM 2013 On-Pre.

    Error message:

    Syntax error '$' at position 4.

    Odata query:

    http://mycrmserver/myorg/XRMServices/2011/OrganizationData.svc/AccountSet?$select=Telephone1$filter=AccountId%20eq%20guid'%7xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%7D'

    If I remove $select=Telephone1 then its working fine.

    Please Suggest.

    Thursday, May 1, 2014 12:41 PM

All replies

  • Hi,
    try to use OData Query Designer to build your query:

    http://dynamicsxrmtools.codeplex.com/


    My blog: www.crmanswers.net - Rockstar 365 Profile

    Thursday, May 1, 2014 1:22 PM
  • Hi Guido,

    The queries working fine since they published (may be 4 or 5 before), suddenly they're not working fine even in my dev server its working fine. The clue I've is all users have SalesPerson and SalesManager roles. When log in as Admin its working fine.

    Any suggestions to understand the issue.

    Thanks,

    Kiran.

    Friday, May 2, 2014 5:44 AM
  • Try to use

    http://mycrmserver/myorg/XRMServices/2011/OrganizationData.svc/AccountSet?$select=Telephone1&$filter=AccountId%20eq%20guid'%7xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%7D'


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, May 2, 2014 8:17 AM
    Moderator
  • Hi Pal,

    It's a good catch, but it is not issue its a typo error. Some one suggested to restart DC and CRM server, I did same its working for me. I gave 6GB RAM CRM Server now I upgraded to 8GB its working fine.

    But I'm still not getting it, why this happened.

    Tuesday, May 6, 2014 5:38 AM
  • Try building the URL as follows

    function GetTelephone1(){
    	var Tel1 = GetValueID("AccountSet","xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","Telephone1");
    }
    
    function GetValueID(DataSetName, LookupId, returnAttribute) {
        var filter = "?$select="+returnAttribute;   
        var serverUrl = Xrm.Page.context.getServerUrl();
        var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
        var ODATA_EntityCollection = "/"+DataSetName+"(guid'" + LookupId + "')";
        var ODATA_Final_url = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + filter;
        var retrieveAccountReq = new XMLHttpRequest();
        retrieveAccountReq.open("GET", ODATA_Final_url , false);
        retrieveAccountReq.setRequestHeader("Accept", "application/json");
        retrieveAccountReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        retrieveAccountReq.send();
        return JSON.parse(retrieveAccountReq.responseText).d[returnAttribute];
    }
    You will need to JSON js to your solution.

    Tuesday, May 6, 2014 1:38 PM