2

I am trying to replicate Dynamics 365 in an Azure SQL database (https://learn.microsoft.com/en-us/dynamics365/customer-engagement/admin/replicate-data-microsoft-azure-sql-database#create-an-export-profile).

This requires me to enable "change tracking" on ~800 entities. Is there a way to do this programmatically or will I have to enable it manually for each entity?

Chris
  • 1,150
  • 3
  • 13
  • 29

2 Answers2

4

I could not find a plugin in XrmToolBox to achieve this.

Better to write a console app which will retrieve all the entities using RetrieveAllEntitiesRequest, then iterate through each Entity in the retrieved Metadata collection & update back by setting the EntityMetadata.ChangeTrackingEnabled property.

Sample snippet from this reference:

UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
     Entity = BankAccountEntity,
     ChangeTrackingEnabled = true //or false here
};

_serviceProxy.Execute(updateBankAccountRequest);

You can use web api also. Read more.

1

A C# program exists on git as a plugin For XRMToolbox. The freely available, Cobalt's "Bulk Update Entity Change Tracking" Allows for the user to update the change tracking property on entities in bulk. it was released about 2 months after the OP asked the question.

I cloned and compiled it on my computer and restarted XRMToolbox and it worked.

It requires one unmanaged solution to apply the changes to. I create one empty solution before using the tool. Remember to Publish all customizations from that solution when done saving from the tool.

Cheers

Bulk Update Entity Change Tracking

DaFi4
  • 1,364
  • 9
  • 21