When trying to import a solution into CRM 2011, if you try import a field with the same name as an existing field but with a different data type, you will receive the following error.
Attribute <Attribute Name> is a <Existing Data Type>, but a <Import Data Type> type was specified.
Usually this happens when attempting to convert a field to a different type. In an environment where there is no data that cannot be lost, this is usually not an issue as one can simply
- Delete the existing attribute
- Import the solution again
In a production environment or an environment where data cannot be lost, this is not so simple as step 1 above will result in all data in the field being lost.
Enter the CRM2011 Field Data Converter…
The CRM2011 Field Data Converter does the following:
- Accepts a CRM Url and credentials, an entity and field, a destination type and various type specific parameters.
- Checks whether the supplied entity and field exist and what the field’s existing type is.
- Checks whether the source field can be converted to the destination type (see Conversions).
- Backs up the existing data.
- Deletes the source field.
- Creates a new field with the same name and new data type using the supplied type specific parameters.
- Populates the data back into the field (converted to the new type – see Conversions).
- Outputs a file listing the failures (conversion failures, save failures)
The CRM2011 Field Data Converter DOES NOT do the following:
- Recover from catastrophic failures: As the data is backed in “in memory”, if a server, network or SQL instance goes down after storing the data and deleting the field, the DATA WILL BE LOST. BACK UP YOUR CRM DATABASE BEFORE RUNNING THIS TOOL.
- Delete dependencies on the source field: If the source field cannot be deleted manually within CRM, it cannot be deleted by this tool. All dependencies on the field (forms, views, etc) must be manually removed before the tool is run and put back afterwards.