Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 2.33 KB

README.md

File metadata and controls

49 lines (35 loc) · 2.33 KB

CRM Bulk Operations API - Dynamics 365 (8.2 )

See Pre71 branch for CRM 2015 and CRM 2015 version of the API

You can install this into a project using the following NuGet Console command Install-Package CRMBulkOperations -Pre

NuGet project page https://www.nuget.org/packages/CRMBulkOperations

The CRMBulkServiceManager is a helper class to perform bulk operations with Dynamics CRM. The library has support for both Execute Multiple and Threads for batching multiple requests and managing sending them to Dynamics CRM.

The following types of operations are supported by the CRMBulkServiceManager class

  • Bulk Insert
  • Bulk Update and Upsert
  • Bulk Update from Query
  • Bulk Run Workflow
  • Bulk Run Workflow from Query
  • Bulk Set State
  • Bulk Set State from Query
  • Bulk Run an array of requests as part of a transaction
  • Run Multiple Request to handle all other types of Organization Request

The CrmChangeTrackingManager is a helper class to work with the CRM Change Tracking feature. The class uses CrmBulkServiceManager class for transaction and upsert support.

The following are the type of operations supported by the CrmChangeTrackingManager class

  • Apply changes to target CRM for one entity
  • Apply changes to target CRM for multiple entities

To use Apply Changes you need to do the following

  • Enable Change Tracking on the Entities in the Source CRM

  • Import the solution $/CRMSolutions/ctccrm_CTCEntityChangeTracking_1_0_0_0_managed.zip into the Target CRM

  • Execute the following code - configuring for the entities you wish to sync

          CrmConnection connectionSource = new CrmConnection("CRM");
          OrganizationService serviceSource = new OrganizationService(connectionSource);
    
          CrmConnection connectionTarget = new CrmConnection("CRM2");
          OrganizationService serviceTarget = new OrganizationService(connectionTarget);
    
          CrmChangeTrackingManager mgr = new CrmChangeTrackingManager(serviceSource);
          
          mgr.ApplyChanges(serviceTarget,new ApplyChangesOptions[] 
                               { 
                                   new ApplyChangesOptions() { EntityName="account", Columns=new ColumnSet(true)},
                                   new ApplyChangesOptions() { EntityName="contact", Columns=new ColumnSet(true)},
                               });