My program will be Creating 100 to 200 new contacts, and Updating 1,000 to 2,000 existing contacts as part of a daily batch job. We're moving to Dynamics CRM from Infusion Soft where we used the addWithDupCheck method which either adds or updates a contact record based on a matching field value. I know I could query for the existence of a contact then use Create or Update, however, I'm looking for a solution that works with ExecuteMultipleRequest.
2 Answers
If you are using 2013 you will not have the option of an UPSERT request, like you would in Online 2015 Update 1 unfortunately.

- 759
- 3
- 11
-
I'm using Online 2015 Update 1; I selected the wrong TAG when creating the question. UpsertRequest is what I was looking for. – ddrjca Aug 09 '15 at 12:28
-
Is there an updated CRM SDK download with the 7.1 binaries or is NuGet the only way to get the updates? – ddrjca Aug 09 '15 at 12:37
-
Here is the link to the CRM 2015 SDK Release History: https://msdn.microsoft.com/en-us/library/dn481567.aspx – Alessi Aug 10 '15 at 00:45
The ExecuteMultipleRequest
will only give a minor performance gain. This is because the requests it contains are processed sequentially by the server on a single thread. Your only gain is fewer round-trips to the server.
For CRM 2013 (version 6) you could consider to retrieve a list of the existing contact records from CRM before processing the records to be created or updated. Querying less than 5,000 records from CRM should not be an expensive or time consuming operation.
For CRM 2015 Update 1 (version 7.1) a new useful option is added, called the UpsertRequest
. This request can be used to update an existing record or create a new one if it does not yet exist. The UpsertRequest
uses alternate keys (these are configurable), which in your scenario would be the primary keys of the contact records in the source system. You can find more information on this topic on MSDN.

- 7,357
- 6
- 32
- 42