CRM 2011 JScript retrieveMultiple抛出错误的请求错误

时间:2013-02-15 10:47:12

标签: javascript dynamics-crm-2011 dynamics-crm jscript

我正在尝试使用联系表单上的oData检索多条记录,但它会抛出Bad Request错误。任何人都可以建议我为什么会这样。

提前致谢

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

2 个答案:

答案 0 :(得分:4)

试试这个:

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

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

答案 1 :(得分:1)

我认为filter不见了!! 试试这个:

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