简体   繁体   中英

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

Try this:

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

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

I think filter is missing!! Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM