1

I am trying to replicate Dynamics 365 in an Azure SQL database (https://docs.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?

Arun Vinoth
  • 20,360
  • 14
  • 48
  • 135
Chris
  • 968
  • 1
  • 10
  • 24

1 Answers1

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.

Arun Vinoth
  • 20,360
  • 14
  • 48
  • 135