Migrating Dynamics 365 v9.0 Multi Select Option Set Field Data using SSIS

By | February 7, 2018

Introduction:

Microsoft Dynamics 365 v9.0 brings some of the most awaited features and enhancements. One of the important feature introduced in Dynamics v9.0 is Multi Select Option Set. Prior to Dynamics 365 v9, there was no provision to use multi-select option set field. Our this blog explains how data import works for multi-select option set field.

In this blog, we will see Migrating Dynamic 365 Multi Select Option Set Field data using SSIS.

Migrating Dynamic 365 Multi Select Option Set Field data:

SSIS Toolkit from our friends at KingswaySoft has always been our preferred tool for data migration and in the latest release, the team has introduced v9.1 of SSIS Integration Toolkit for Microsoft Dynamics 365.

Below are the steps to migrate the Multi Select Option set field value:

For example, consider a Multi Select option set field i.e. Select Choices (new_selectchoices)

  1. Create Connection Manager for Source and Destination CRM.
  2. Map the MultiSelect option set field in the Destination as given in below screenshot.multi-select-optionset-migration1
  3. If you want to change any options in the MultiSelect Option Set field for Destination CRM, then you need to follow the below steps :
  • Add an output column.multi-select-optionset-migration2
  •   Write custom code in a script as given below.
      private void SetMultiOptionSetValue(ref Input0Buffer Row)
        {
            string functionName = "SetMultiOptionSetValue ";
            List<string> listSTR = new List<string>();
            string updatedString = string.Empty;
            string s = string.Empty;
            try
            {
              string selectChoicesByName = Row.newselectchoicesname;
    
                listSTR = selectChoicesByName.Split(';').ToList();
    //Note: you can use value instead of string also
                listSTR.Remove("Item 4");
                listSTR.Add("custom");
                for (int i = 0; i < listSTR.Count; i++)
                {
                    if (i == listSTR.Count - 1)
                    {
                        s += listSTR.ElementAt(i);
                    }
                    else
                    { s += listSTR.ElementAt(i) + ";"; }
                }
    
                Row.opMultiSelect = s;
                  
            }
            catch (Exception ex)
            {
    
                throw new Exception(functionName + ex.Message); ;
            }
        }

    We need to concatenate all the option’s values in a string separated by “;”, Here we are storing the option’s value in a string and assigning it to output column i.e. opMultiSelect.

    4. Map this output column to the Destination MultiSelect Option Set field.multi-select-optionset-migration3

    In above example, we have mapped Multi Select Option Set field with the label. Like above user can map with the values also.

    Note: Please use the latest version of Kingswaysoft for above Migration.

    Conclusion:

    We can migrate Multi Select Option Set field from one environment to another using steps described above. If you are migrating Multi Select Option Set field from one environment to another using KingswaySoft SSIS toolkit for Dynamics 365 v9.0 then you need to map Multi Select Option Set field with label or value.