在 n:n 表中创建行时,BusinessColumnName 无效

问题描述 投票:0回答:1

我在使用关联方法时遇到错误: Microsoft.Xrm.Sdk.InvalidPluginExecutionException:OrganizationServiceFault:无效的 BusinessColumnName Guid 值 = PlatformName = new_AccountingLevel 和 objectId = 1aa032d5-02cb-ed11-99b5-005056b20412 --->

我正在尝试在我的插件的动态中的 n:n 表中添加一行,这是我的代码:

var accountingLevel = _client.new_AccountingLevelSet.FirstOrDefault(al =>
                al.new_AccountingLevelId == new Guid("1AA032D5-02CB-ED11-99B5-005056B20412"));

            var relationship = new Relationship(new_new_cash_box_new_accountinglevel.EntityLogicalName);



            _context.Service.Associate(new_cash_box.EntityLogicalName,
                target.new_cash_boxId.Value, relationship,
                new EntityReferenceCollection
                {
                    new EntityReference(new_AccountingLevel.EntityLogicalName,
                        accountingLevel.new_AccountingLevelId.Value)
                });

我检查过,我确信 target 和accountingLevel 都不为空,我也尝试过使用target.Id 和accountingLevel.Id 我也尝试过这个:

_context.Service.Associate(new_cash_box.EntityLogicalName,
                target.new_cash_boxId.Value, relationship,
                new EntityReferenceCollection
                {
                    accountingLevel.ToEntityReference()
                });

这是我的 n:n 表列:new_accountinglevelid、new_cash_bodi、new_new_cash_box_new_accountinglevelId 关系本身运行良好,我通过从子网格添加项目来尝试它。

c# dynamics-crm
1个回答
0
投票

在这一行中:

var relationship = new Relationship(new_new_cash_box_new_accountinglevel.EntityLogicalName);

使用实体逻辑名称代替相交的模式名称。它们通常是相同的,但也可能不同。

© www.soinside.com 2019 - 2024. All rights reserved.