4

I am trying to retrieve multiple records using oData on Contact form but it's throwing Bad Request error. Can anyone suggest me why it's happening.

Thanks 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);
}
user1211185
  • 731
  • 3
  • 12
  • 27

2 Answers2

4

Try this:

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

    retrieveMultiple("ConnectionSet", "ConnectionId,Record2Id", "Record2Id/Id eq guid'" + contId + "'",    successCallbackConnections, errorCallbackConnections, true);
}
Scorpion
  • 4,495
  • 7
  • 39
  • 60
1

I think filter is missing!! Try this:

retrieveMultiple("ConnectionSet", "?$filter=YourAttributeHere eq '" + contId + "'", successCallbackConnections, errorCallbackConnections, true);
Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149