在尝试合并 Microsoft CRM 中的联系人时,我正在使用以下代码 -
//c1ID and c2ID are GUIDs of duplicated contacts.
EntityReference target = new EntityReference();
target.LogicalName = Contact.EntityLogicalName;
target.Id = c2ID;
MergeRequest merge = new MergeRequest();
// SubordinateId is the GUID of the account merging.
merge.SubordinateId = c1ID;
merge.Target = target;
merge.PerformParentingChecks = true;
Contact updater = new Contact();
Contact updater2 = new Contact();
updater = (Contact)xrmSvc.ContactSet.Where(c => c.ContactId.Equals(c1ID)).First();
updater2 = (Contact)xrmSvc.ContactSet.Where(c => c.ContactId.Equals(c2ID)).First();
MergeResponse mergedR = (MergeResponse)xrmSvc.Execute(merge);
当我在这里尝试执行调用时,我得到了这个错误 -
Cannot specify child attributes in the columnset for Retrieve. Attribute: owneridname.
我是不是设置不正确?
最佳答案
拥有 updatecontent
不会改变问题。事实上,我在输入 updatecontent
的查找时遇到错误。我发现您必须构建新的实体引用:
if (match.Contains("new_mostrecentcampaign"))
master["new_mostrecentcampaign"] =
new EntityReference(match.GetAttributeValue<EntityReference>("new_mostrecentcampaign").LogicalName
, match.GetAttributeValue<EntityReference>("new_mostrecentcampaign").Id);
...
Merge.UpdateContent = master
...
关于dynamics-crm - 无法在列集中为检索指定子属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12919240/