CRMWebAPI-如何使用实体引用?

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

我将CRMWebAPI用于CRM的CRUD操作。如何在那里使用实体引用?

例如,当我要更新帐户实体上的上级帐户属性时,上级帐户属性是“查找其他帐户”。

类似这样的东西:

dynamic updateObject = new ExpandoObject();
updateObject.parentaccountid = the_entity_reference;
dynamic updateResult = await api.Update("accounts", new Guid("1111111-2222-3333-4444-55555555"), updateObject, false);
c# .net dynamics-crm crm dynamics-crm-webapi
1个回答
1
投票

Referred this code sample并能够撰写。请对其进行测试。

dynamic updateObject = new ExpandoObject();

Guid accountID = new Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx");    
var parAcctIndexer = updateObject as IDictionary<string, Object>;
parAcctIndexer["[email protected]"] = "/accounts(" + accountID.ToString() + ")";

dynamic updateResult = await api.Update("accounts", new Guid("1111111-2222-3333-4444-55555555"), updateObject, false);
© www.soinside.com 2019 - 2024. All rights reserved.