Dynamics CRM 2011 Bulk Update

前端 未结 10 1239
慢半拍i
慢半拍i 2021-02-07 06:18

Running Dynamics CRM 2011 rollout 3. Need to update millions of customer records periodically (delta updates). Using standard update (one by one) takes a few weeks. Also we don\

10条回答
  •  [愿得一人]
    2021-02-07 07:13

    CRM doesn't implement a way to update bulk data; there are 3 ways to improve the bulk update operation performance but internally they cannot change the fact that CRM updates record one by one. Basically the ideas are:

    • reduce the time wasted on communicating to CRM server
    • use parallelism to do multiple operations at the same time
    • make sure the update process does NOT trigger any workflows/plugins. Otherwise you might never see the end of the process...

    3 ways to improve bulk operation performance:

    1. After RollUp 12 there is a ExecuteMultipleRequest feature, which allows you to send up to 1000 requests at once. This means you may save some time from sending 1000 requests to CRM web service, however, these requests are processed one after another. So if your CRM server is well configured, most likely this method won't help too much.
    2. You may use OrganizationServiceContext instance to do bulk update. OrganizationServiceContext implements unit of work pattern so you can do multiple updates and transmit these operations to the server in one call. Comparing to ExecuteMultipleRequest, it doesn't have a limit on request amount, but if it encounters a failure during the update, it will rollback all the changes.
    3. Use multithreading or multitask. Either way would improve the speed, but they are likely to generate some connection failures or SQL errors, so you would need to add some retry logic in the code.

提交回复
热议问题