locked
oData returning ParentRoleId instead of Role Id RRS feed

  • Question

  • Hi, 

    I am using oData to get the User/Team Role back from CRM. I have two filters in my query as shown bellow. But its returning the 'ParentRoleId' rathen than 'RoleId'. Can anyone please help me out.

    var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/"; oDataEndpointUrl += "RoleSet?$top=1&$filter=Name eq '" + roleName + "' & BusinessUnitIdName eq 'ABC'";

    var service = GetRequestObject();

        if (service != null)
        {
            service.open("GET", oDataEndpointUrl, false);
            service.setRequestHeader("X-Requested-Width", "XMLHttpRequest");
            service.setRequestHeader("Accept", "application/json, text/javascript, */*");
            service.send(null);

            var requestResults = eval('(' + service.responseText + ')').d;

            if (requestResults != null && requestResults.results.length == 1)
            {
                var role = requestResults.results[0];
                var id = role.RoleId;

    }

    }

    Thanks in advance


    Thursday, August 1, 2013 10:13 AM