AttributeInfo.TypeName(int) != AttributeMetadata.Type.Name(float)

You might bump into an error message while importing an entity from a customizations file. The error show could be:


Error: lead: AttributeInfo.TypeName(int) != AttributeMetadata.Type.Name(float)

The cause of this error is a mismatch in attribute type. Usually a field has been removed in the other environment and has been recreated with another attribute type. The type in your destination CRM system of an attribute is the type displayed in the right side of the != statement. In the example above float. The type in the import file is the type displayed on the left side of the != statement. This is int in the example above. In order to get rid of this error message and to import the entity, you will need to remove the attribute from the destination system.

In the list of attributes, search for a custom attribute which has the same type as displayed on the right side of the equation. Determine if there is any of these which has been changed. Delete this attribute and import the entity again. Keep in mind that the attribute must be removed from the form first (also the published form) before it can be removed from the attribute list. Another thing to keep in mind, is that when you perform this action on a production system, that the data in the attribute will be removed. Since this is not recoverable, you should first perform the removal of the attribute by following the next steps:
- create a new custom temporary attribute
- copy the data from the old attribute to the temporary attribute for each record
- remove the attribute
- import the entity (and with that the new attribute)
- copy the data from the temporary attribute to the new attribute for each record
- remove the temporary attribute

If there are many custom attributes, it might be hard to locate which of these is causing the error to appear. Unfortunately the name is not in the error description and also the event viewer and tracing does not mention the exact attribute name. To find out which of the attributes is causing the error, you should start the database profiler. Start a new trace and run the import. As soon as the error shows up, stop the tracing. In the trace search for the last occurence of:

exec sp_executesql N'SELECT T1.AttributeId AS attributeid

When you have found this record, copy the whe query. When you run this query in the SQL Server Management Studio, then only a single record should be returned. One of the attributes in the result is the name attribute. This is the attribute which is changed and will need to be removed.

Disclaimer: Only perform actions on the database if you are comfortable with the technologies. Incorrect SQL statements can corrupt your database and cause mayor dataloss. Always make a backup before performing database queries against your CRM database.

7 comments:

Anonymous said...

ping back from http://www.castorsoft.com/articles/2008.1.21.htm

aarch said...

Thanks alot :-)

aarch said...

thanks alot :-)

Anonymous said...

That helped me out. Thank you

Anonymous said...

nice post

Anonymous said...

Thanks that saved me alot of time

Anonymous said...

Thanks for the great post. It is really helpful. Always a big fan of your blog... keep up the good work.
Best Wishes

JJ