CREATE OR UPDATE (UPSERT) RECORDS USING ALTERNATE KEYS IN DYNAMICS 365 SDK
In another post, we saw how to retrieve a record based on alternate key in Dynamics 365 using the SDK In this post, we will see how to create or update (upsert) a record based on alternate key in Dynamics 365 using the SDK . The below sample code can be used to achieve the UpdateRequest. For the sake of this post, the alternate key is set up on the Account Name (name) field of the account entity. public void UpsertRecordByKey() { KeyAttributeCollection keys = new KeyAttributeCollection { { Account.Fields.Name, "cak account" } }; Account objAccount = new Account(); objAccount.Name = "cak account"; Upse...