Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Bulk Updation of Records - MSCRM 2016 online

$
0
0

Hey,

I want to update a bulk records to CRM using an console application, I have to update the two date fields, I have retrieved those records from excel now to bulk update, I have written a function like below but its still not updating

 private static void UpdateCRM(OrganizationServiceProxy service)
        {
            for (int i = 0; i < lstentity.Count; i += 1000)
            {
                ExecuteMultipleRequest requestWithNoResults = new ExecuteMultipleRequest()
                {
                    Settings = new ExecuteMultipleSettings()
                    {
                        ContinueOnError = true,
                        ReturnResponses = false
                    },
                    Requests = new OrganizationRequestCollection()
                };

                // Update the entities that were previously created.
                EntityCollection update = new EntityCollection(lstentity.Skip<Entity>(i).ToList().Take<Entity>(1000).ToList());

                foreach (var entity in update.Entities)
                {
                    UpdateRequest updateRequest = new UpdateRequest { Target = entity };
                    requestWithNoResults.Requests.Add(updateRequest);
                }

                ExecuteMultipleResponse responseWithNoResults =
                    (ExecuteMultipleResponse)service.Execute(requestWithNoResults);
            }
        }
        #endregion
    }



Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>