Dynamics 365 Data Migration - how to keep the original Modified On date

Nick Chin, 27 November 2019

When moving from a legacy system to Dynamics 365, sometimes it’s important to maintain the “Modified On” date for records, such as Activities. The Timeline control displays Notes and Activities in the order that they are modified.

Setting the “Modified On” field in a data migration isn’t possible as the field is handled automatically in the CRM platform. This blog provides a workaround to this problem

The Timeline sorts all records by the “Modified On” date by default, therefore all the imported Timeline records will appear to have been updated at the import date even though it was originally last modified at a different date. Also, the ordering can become incorrect due to when the records are imported.

Note: while you can change the sort by field, it doesn’t affect Notes.

Here is an example where the “Last Updated” or “Modified On” date is set to the date the records are imported.

If you are familiar with Plugins you can trigger them on the Pre-Operation, which is before the operation has been completed. Therefore, on the Pre-Create you can change the “Modified On” date to the original before the record is created.

You will need to store all the data where the plugin can access it. I use an entity to store the “Modified On” date data, I called it “DM Modified On” for this example. This allows me to search for each record created by their Entity Id and find the original Entity’s “Modified On” date.

When creating the “Modified On” date to store the original “Modified On” date, keep the field configuration the same.

        

Register the plugin step with Message = “Create” and Eventing Pipeline Stage of Execution = “Pre-operation”

Remember to turn off the plugin when the Data Migration has been completed, because it won’t be needed.

Now once importing the data, you can check the dates.

In our data migration testing, there were three Activities that didn’t have the original “Modified On” date. This is because the activities are inactive and another update happens afterwards to change the status, which causes the “Modified On” date to be set to the status update time.

Here you can see the completed Activities don't have the original Last Updated (Modified On) date, whereas the open Activity displays the correct Last Updated.

The solution for this is to create another plugin to replace the “Modified On” date, using a trigger on the Pre-Operation Update filtering on “statecode”.

Below you can see the rest of the Activities and Notes imported with the correct dates and order.

Note: I imported the data with SSIS and KingswaySoft because you have more control than the “Import Data” and it’s quick to build.

Here I have demonstrated a way to preserve the original “Modified On” dates, hopefully this will be of some use.