Migrate related data

  1. From the folder in which you cloned the Related data migration GitHub sample, copy the following files:

    • RelatedDataMigration.aspx
    • RelatedDataMigration.aspx.cs
    • RelatedDataMigration.aspx.designer.cs
  2. Paste the files in your Sitefinity CMS project folder.

  3. Open your project in Visual Studio.

  4. Include the above files in your solution and build it.

  5. Run the project.

  6. Create a new Related data field.
    For more information, see Add a related media custom field.
    Make sure that you are relating to the correct Data typeand Source.

  7. Open page ~/RelatedDataMigration.aspx.

  8. Depending on the type of old field you used, from the Migration type dropdown menu, select one of the following:

    Old field

    Migration type

    New field prerequisite 

    Guid array

    Multiple Dynamic selector field (Guid array)

    In the Related data field designer,
    select the Multiple items from this data type can be related checkbox.

    Guid

    Single Dynamic selector field (Guid)

    In the Related data field designer,
    do not select the Multiple items from this data type can be related checkbox.

    Media

    Media field

    When creating a new Related media field, make sure you apply the same configuration as the one for the old

    Media field.
    NOTE: The old

    Media field supports data from multiple providers and the Related media field supports only one provider.

    9. Fill the form in the *RelatedDataMigration*page with the required data for the migration. For more information about parent and child relations, see [What is related content](slug://what-is-related-content). - *ParentItemType* - the dynamic content type containing the fields - *ChildItemType* - the related content type - *ParentItemProviderName* - *ChildItemProviderName* - The old selector or media field name - The name of the newly created *Related data* or *Related media* field 10. Click *Migrate data*. The *Migration log* text area provides information about the migration process. For more detailed information about the status of the migration process, check the `Migration.log` file located in the `\App_Data\Sitefinity\Logs` folder. In case of an exception, check the `Error.log` file, located in the same folder.
    > info **NOTE**: Wait for the migration process to be completed before you attempt to access the items being migrated.
    1. Check manually whether field values of a few items are accurately migrated.

      NOTE: You need to refactor any frontend widgets that used the old fields and now need to use the new Related data and Related media fields.

    2. Delete the old selector or media field.

      After you have verified that the new fields contain the accurate migrated data, you can go to the structure of the dynamic module type and delete the old field. This deletes all old records and drops the old field table (in case you used Guid Array and media mappings).

Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?