user1211185
user1211185

Reputation: 731

CRM 2011 JScript retrieveMultiple throwing Bad Request Error

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);
}

Upvotes: 4

Views: 693

Answers (2)

Yaqub Ahmad
Yaqub Ahmad

Reputation: 27659

I think filter is missing!! Try this:

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

Upvotes: 1

Scorpion
Scorpion

Reputation: 4585

Try this:

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

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

Upvotes: 4

Related Questions