1
votes

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?

1

1 Answers

4
votes

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.