Migrate data from a legacy system into Dynamics 365

Introduction

This post steps through the migration of data from a legacy system (the legacy data being extracted into spreadsheets) and into a Dynamics 365 environment. Specifically the migration of contacts, including their residential addresses

Note: This is an example of a small migration. For a larger migration, I would consider setting up staging tables rather than using spreadsheets. These tables would mirror the structure of the Dynamics 365 / Dataverse tables

Steps to migrate data into Dynamics 365

Generate empty spreadsheets

1.) Within Dynamics 365, click on Settings, Data Management (Figure 1)

Figure 1

2.) Next, click on ‘Imports’ (Figure 2)

Figure 2

3.) Export the Contact and Address tables into two spreadsheet templates (Figure 3)

Figure 3

4.) Clear any data contained in the spreadsheets (Figure 4)

Figure 4

Populate the spreadsheets

5.) Cleanse and apply uniform formatting to the legacy data displayed in Figure 5. For example, ensure the formatting of the ‘Date of Birth’ in each record matches

Figure 5

6.) Copy the cleansed legacy data into the ‘Contact’ & ‘Address’ spreadsheets created in the previous section.

(Although not shown in this example, if the ‘created on’ date for each legacy record needs to be maintained, map this value to the Dataverse column ‘Record Created On’ (logical name overriddencreatedon). The value placed here will be written to the Dataverse column ‘Created on’ during the data import process.)

7.) Take the ‘Address’ spreadsheet (Figure 6) an ensure each address is unique by highlighting the cells in ‘Street 1’ column, selecting ‘Conditional Formatting’, ‘Highlight Cell Rules’ and finally selecting ‘Duplicate Values’.

Figure 6

8.) Create a column called ‘AddressRef’ which will be used to link the ‘Address’ spreadsheet to the ‘Contact’ spreadsheet

9.) Take the ‘Contact’ spreadsheet and create a VLOOKUP to the address spreadsheet. Also, link the Contact spreadsheet to the Address spreadsheet via the column ‘Primary Address Lookup’

Figure 7

10.) Ensure that the Option set & Owner columns within the spreadsheets contain values that already exist in the Dynamics 365 environment. Otherwise the import of that particular spreadsheet would fail.

11.) Place the spreadsheets on OneDrive in order for them to be shared securely and have their version history maintained. (I needed to set the spreadsheet on One Drive to Region – Australia to resolve issues I was having with dates. That is, some date values where showing in Australian format whilst others were shown in US format.)

Import the data into Dynamics 365

12.) Import the Address spreadsheet into Dynamics 365

13.) Then import the Contact spreadsheet making sure to set the lookup reference (Figure 8)

Figure 8

Note: an active plugin or workflow may stop data being imported (Figure 9). An example of this is trying to import invoices when the corresponding mandatory orders don’t yet exist. That is, when a new invoice is created, the plugin/workflow tries to retrieve the corresponding order to perform some logic

Figure 9

Appendix

Updating Business Process Flows (BPFs)

Migrated tables that contain a business process flow may need that flow updated after the migration. Referring to Figure 10, the BPF needs to be placed in the ‘complete’ state.

Figure 10

To place all the relevant BPFs in the complete state, follow these steps

  • Use the XrmToolBox BPF plugin to perform a bulk move from the stage ‘Preparation’ to ‘Send For Approval’
  • In the ‘Form’ entity, perform a build set of the field ‘Approval Requested To’
  • For the BPF entity, update
    • ‘Completed On’ to current date
    • ‘Status Reason’ to finished
    • ‘Status’ to inactive

Prepare legacy data to be imported into Dynamics 365

The example shown in Figure 5 takes legacy data from one legacy database table and maps it to two Dynamics 365 tables. This example takes two legacy database tables (Figure 11 & 12) and consolidates them into one Dynamics 365 table

Figure 11 – Client Contacts table
Figure 12 – Selection List Item table

The following SQL retrieves the data from the two legacy tables and maps them to the columns of a Dynamics 365 table (Figure 13)

Figure 13 – the combined table

The result set is then placed into a spreadsheet which can then be imported into the Dynamics 365 environment

Further reading

Maintain the same guids in Dynamics 365 environments

References

https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1