Dynamics CRM 2011 Bulk Update

前端 未结 10 1244
慢半拍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:04

    The BulkUpdate API works well for me; it is 10 times faster than updating records one at a time. Following is a snippet that performs a bulk update:

        public override ExecuteMultipleResponse BulkUpdate(List entities)
        {
            ExecuteMultipleRequest request = new ExecuteMultipleRequest()
            {
                Settings = new ExecuteMultipleSettings()
                {
                    ContinueOnError = true,
                    ReturnResponses = true
                },
                Requests = new OrganizationRequestCollection()
            };
    
            for (int i = 0; i < entities.Count; i++)
            {
                request.Requests.Add(new UpdateRequest() { Target = entities[i] });
            }
    
            return (ExecuteMultipleResponse) ServiceContext.Execute(request);
        }
    

提交回复
热议问题