Reputation: 1242
I use CRMWebAPI for CRUD operations with CRM. How can I work there with a entity reference?
For example when I want to update parent account attribute on the Account entity, where the parent account attribute is Lookup to another account.
Something like this:
dynamic updateObject = new ExpandoObject();
updateObject.parentaccountid = the_entity_reference;
dynamic updateResult = await api.Update("accounts", new Guid("1111111-2222-3333-4444-55555555"), updateObject, false);
Upvotes: 1
Views: 280
Reputation: 22836
Referred this code sample and able to compose this. Please test it.
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);
Upvotes: 1