How to use Configuration Migration / Data Migration Utility in Dynamics CRM

In this blog i will detail on using Configuration Migration/ Data Migration utility. This can be used to move the configuration data from one CRM environment to other. generally Configuration data is used to defines custom functionality in CRM, which is typically stored in custom entities.

Often we need to migrate configuration data from one CRM environment to other, especially test data, master data setup etc. Microsoft provided an excellent tool for doing this.

Following are the benefits of using this tool,

  1. allows you to select entity and fields from where you want to export the configuration data.
  2. large amount of data from multiple entities can be moved from one crm environment to other.
  3. Data can be imported using the same GUID’s as that of the source system, hence lookup references to imported records will be valid.
  4. Schema file can be reused to export data from different source environments.

Below are the main steps to use this tool,

  1. Create schema file.
  2. export the data from source CRM environment.
  3. import the data into target CRM environment.

It is important that both source and target environments must have same configuration for the entities and fields that are selected in schema file.

Create schema file

  1. Open DataMigrationUtility from Configuration Migration folder. If you need to download Configuration migration tool, please use this link.
  2. Click on “Create Schema” and Continue. This will take you to the login screen. enter the login details to connect to your CRM environment.

CM1

CM8

3. You will be presented with below screen, where you can select the solution which contains your customization. Select your solution and select the entity you want to add.    Add fields: this will add the selected fields of the entity into schema.                                Add entity: this will add all fields from the entity along with N:N relationships.                  Add All: this will add all entities , their fields and N:N relationships.                                        Clear Selection: this will remove all selected entities/fields from the selection.                    After you have selected entities/fields, hit”Save and export” button. That will ask you to specify the path and name for the schema file it is going to generate.

CM2      4. Once you provide the file path, tool will save the schema file and ask the if “you would like to export the data”. If you says, YES then you have to choose a location to save the data file as shown below.        CM3

CM6

5. Hit “Export Data” to export data as per the schema you have created. You can see the export status, no of records exported in the status text area.

Cm5

6. If you open the ZIP file (data.zip) that was created after export, it will have data(data.xml) file as well as schema(data_schema.xml) file.

Export data: If you already have a schema file and want to export data from source CRM environment, follow below steps,

  1. From the DataMigrationUtility, select “export data” and hit “Continue” button. This will take you to the login screen. Enter the connection details of source CRM environment from where you want to export data.
  2. Once login is successful, you will be presented with below screen, where you need to select the schema file and target location to save your data file. Then click “Export data”.

CM63. Once the export is completed, you can see data.zip file in the location you have selected.

Import Data: Once you have the data file with you, follow below steps to import data into target CRM environment

  1. Select “Import data” option from the DataMigrationUtility and hit “Continue” button. This will take you to the login screen where you need to enter target CRM environment details.

CM7

2. Select the data file (data.zip) that need to be imported, hit “Import Data” button. You can view the import status directly on the tool, as shown below.CM10

This will import the record into the target environment.

Few Tips: 

  1. How the tool identifies weather to create or update a record in target?

by default, tool will look at name field of the entity to identify weather to create/update the record. We can set the schema file in such a way that the tool will look for a different field to identify create/update scenario. Once we added the entity/fields while creating the schema file, click on Tools –> Configure Import Settings

CM11

on the new window, select the field on the left side and click “Add field” and save. In my case, i am going to select the primaryGUID field of the entity.

CM12

2. How to disable plugins when importing data ?

While creating schema, navigate to Tools –> Configure Import Settings, you will see option to disable plugin for the current entity or all entities for import as shown below,

CM12

3. Where to look for logs?

Navigate to Logs menu on the DataMigrationUtility which will give you running logs if any import is in progress or last imported logs.

CM13

Hope this is helpful!

Advertisements