简体   繁体   English

使用OData在Dynamics CRM中检索多个实体

[英]Retrieve Multiple Enitiies in Dynamics CRM using OData

I have a ribbon button command which executes a javascript function and passes in the selected rows in a grid. 我有一个功能区按钮命令,该命令执行javascript函数并在网格中传递选定的行。 I am looping through that list to create a $select filter to make a RetrieveMultiple request. 我遍历该列表以创建$ select过滤器以发出RetrieveMultiple请求。 The problem is everytime I get the following error 问题是每次我遇到以下错误

400: Bad Request: No Property 'id' exists in type 'Microsoft.Xrm.Sdk.Entity' at position 1 400:错误的请求:在位置1的类型'Microsoft.Xrm.Sdk.Entity'中不存在属性'id'

I have tried with id instead of Id but I still get the same error. 我尝试使用id而不是Id进行尝试,但仍然遇到相同的错误。 My code is below 我的代码如下

function approveMultipleApplications(selectedApplicationReferences) {
    if (selectedApplicationReferences && selectedApplicationReferences.length > 0) {
        var filter = '';
        for (var i = 0; i < selectedApplicationReferences.length; i++) {
            filter += '(id eq guid\'' + selectedApplicationReferences[i].Id + '\')';
            if (i < selectedApplicationReferences.length - 1) {
                filter += ' or ';
            }
        }

        var options = "$select=new_assessmentcount,new_requiredassessmentcount&$filter=" + filter;
        try {
            SDK.REST.retrieveMultipleRecords("new_application", options, retrieveApplicationsCallBack, function (error) {
                alert(error.message);
            }, retrieveComplete);
        }
        catch (ex) {
            Xrm.Utility.alertDialog('Something went wrong, please try again or contact your administrator ' + ex, null);
        }
    }
    else {
        Xrm.Utility.alertDialog('You must select at least one application to approve', null);
    }
}

The selectedApplicationReferences[i].Id is in this format {guid-value} Any help or guidance is appreciated selectedApplicationReferences [i] .Id的格式为{guid-value}任何帮助或指导,不胜感激

The error message is pretty much spot on: Use LogicalNameId instead of just Id . 该错误消息几乎可以找到:使用LogicalNameId而不是Id In your case that would be new_applicationId : 在您的情况下,将为new_applicationId

filter += '(new_applicationId eq guid\'' + selectedApplicationReferences[i].Id + '\')';

It can be a bit confusing since there is actually no Id -field in the database. 由于数据库中实际上没有Id字段,因此可能会造成混淆。 If you use eg early bound classes, the Id field is set for you behind the scenes, so that might have confused you. 如果使用例如早期绑定类,则会在幕后为您设置Id字段,这样可能会使您感到困惑。 The Id field is not returned by the OData endpoint. OData端点不返回Id字段。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在CRM 2011中使用OData检索多个 - Retrieve multiple using OData in CRM 2011 动态 crm 使用 odata 从“类型:Microsoft.Crm.Sdk.Data.Services.EntityReference”中检索 guid - dynamics crm using odata to retrieve a guid from "type: Microsoft.Crm.Sdk.Data.Services.EntityReference" 检索多个记录OData java脚本Microsoft Dynamics CRM - Retrieving Multiple Records OData java Scripts Microsoft Dynamics CRM 使用odata和jquery从Dynamics Crm中的实体检索记录 - Retrieving Records From Entity in Dynamics Crm using odata and jquery 为什么此代码不会在Microsoft Dynamics CRM 2011中使用Odata创建机会? - Why will this code not create an Opportunity using Odata in Microsoft Dynamics CRM 2011? 使用JavaScript中的ODATA从Sharepoint页面在Dynamics CRM上运行查询 - Run Query on Dynamics CRM from Sharepoint Page using ODATA in JavaScript CRM动态:oData字符串javascript - CRM dynamics: oData string javascript 使用调用 HTTPRequest 的 FetchXml 查询检索 CRM Dynamics 365 版本 8.2 中的多条记录,但 HTTPRequest 将不起作用 - Retrieve multiple records in CRM Dynamics 365 version 8.2 using FetchXml query calling HTTPRequest but HTTPRequest will not work Microsoft Dynamics CRM-用于检索实体的两个选项集属性的标签的OData url格式是什么? - Microsoft Dynamics CRM - What is the OData url format to retrieve label of two option set attributes of an entity? 如何在Dynamics CRM中使用javascript检索已过滤的实体元数据 - How to Retrieve filtered metadata of entity using javascript in Dynamics CRM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM