CRM 2011 JScript retrieveMultiple throwing Failed request error

I am trying to fetch multiple records using oData

a contact form, but it is throwing an error Bad Request

. Can someone suggest me why this is happening.

Thank you in advance

JScript

// Retrieving multiple connections with accound ID as Record2Id.
function myFunction
{
    var contId = Xrm.Page.data.entity.getId();

    retrieveMultiple("ConnectionSet", "ConnectionId", "Record2Id eq '" + contId + "'",    successCallbackConnections, errorCallbackConnections, true);
}

function successCallbackConnections(data, textStatus, XmlHttpRequest)
{
    for(i=0; i < data.length; i++)
    {
        alert(data[i].RoleName);
    }       
}

function errorCallbackConnections(XmlHttpRequest, textStatus, errorThrown) {
    alert(errorThrown);
}

      

+3


source to share


2 answers


Try the following:



function myFunction
{
    var contId = Xrm.Page.data.entity.getId();

    retrieveMultiple("ConnectionSet", "ConnectionId,Record2Id", "Record2Id/Id eq guid'" + contId + "'",    successCallbackConnections, errorCallbackConnections, true);
}

      

+4


source


I think it is filter

missing !! Try the following:



retrieveMultiple("ConnectionSet", "?$filter=YourAttributeHere eq '" + contId + "'", successCallbackConnections, errorCallbackConnections, true);

      

+1


source







All Articles