Dynamics 365 Dataverse Change Tracking feature (2024)

Hi, Guys,

Today I would like to share the Change Tracking feature of Dynamics 365 CRM.

Why enable Change Tracking?

Change Tracking enables incremental export, only records that have changed are exported.

In addition, you can export or retrieve a selected set of data, and then keep the external data warehouse in sync.

Suppose we have a lot of integrations of D365 CRM with other external systems. We need to keep track of changes done after the last synchronization of data and integrate only those changes to the downstream systems. For this scenario,Change Tracking is the best solution.

How to enable Change Tracking?

You can enable Change tracking for both system and custom tables(entities).

Once you enable the Track Changes you cannot disable it.

Using New UI Power Apps Settings

1, Expand Advanced Options.

For the Create scenario, On the New table page.

For the Update scenario, select a table, and then in Table Properties select Properties. In the Edit table page, expand Advanced Options.

2, In the For this table section, enable the Track Changes checkbox.

Dynamics 365 Dataverse Change Tracking feature (1)

3, Save and Publish.

Using legacy settings

1, Navigate to Customizations->Customize the System.

2, Select an entity, and under Data Services, select the Change Tracking checkbox.

Dynamics 365 Dataverse Change Tracking feature (2)

How to custom query for Change Tracking

In this section, I will show you how to query the Chang Tracing data in the different scenarios and show the response data structure.

First of all, let's take a look atRetrieveEntityChangesRequest andRetrieveEntityChangesResponseclasses.

RetrieveEntityChangesRequest

Input parameters

DataVersion is very import to only retrieve the changed data.

Set it as empty for the first time query, then return all records.

Dynamics 365 Dataverse Change Tracking feature (3)

RetrieveEntityChangesResponse

Dynamics 365 Dataverse Change Tracking feature (4)

Prerequisite

An entity enabled the Change Tracking feature.

Create Scenario:

1, Create a new record namedTest1

Dynamics 365 Dataverse Change Tracking feature (5)

2, Execute below C# code to query the change data.

Dynamics 365 Dataverse Change Tracking feature (6)

We got 1 record as a NeworUpdatedEntity Item.

Dynamics 365 Dataverse Change Tracking feature (7)

The message also returns a DataToken that we can use in the RetrieveEntityChangesRequest, so that when we execute this request the next time, it returns data for those changes that occurred since thelast execution of the request.

Dynamics 365 Dataverse Change Tracking feature (8)

If retrieve again with the DataToken value, then no records were retrieved.

Dynamics 365 Dataverse Change Tracking feature (9)

Update Scenario:

update the Name to Test1-a.

Dynamics 365 Dataverse Change Tracking feature (10)

then execute the query with the previous DataVersion.

Only 1 record was retrieved, and all the columns responded as the result.

Dynamics 365 Dataverse Change Tracking feature (11)

Delete Scenario

Delete the previous recordTest1-a and create a new record Test2.

Execute the query code with the previous DataVersion

2 items were retrieved, 1 is NewOrUpdatedEntity, and 1 for RemovedItem.

Dynamics 365 Dataverse Change Tracking feature (12)

Multiple updates within the same record.

If we change the Name field from Test2 to Test2-1, then update to Test2-1-1.

The last change was responded to as the result.

Dynamics 365 Dataverse Change Tracking feature (13)

END

Hope this will help.

Thanks for reading.

Regards

Dynamics 365 Dataverse Change Tracking feature (2024)
Top Articles
Latest Posts
Article information

Author: Catherine Tremblay

Last Updated:

Views: 5936

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Catherine Tremblay

Birthday: 1999-09-23

Address: Suite 461 73643 Sherril Loaf, Dickinsonland, AZ 47941-2379

Phone: +2678139151039

Job: International Administration Supervisor

Hobby: Dowsing, Snowboarding, Rowing, Beekeeping, Calligraphy, Shooting, Air sports

Introduction: My name is Catherine Tremblay, I am a precious, perfect, tasty, enthusiastic, inexpensive, vast, kind person who loves writing and wants to share my knowledge and understanding with you.