Using SQL to Troubleshoot Import Issues

Sometimes you will come across unusual errors when attempting to import a solution in CRM. Here is a recent example of an import error that failed at the point of updating the "Entity Relationships" for a ClickDimensions upgrade attempt:

"A managed solution cannot overwrite the Attribute component with Id=<some ID> which has an unmanaged base instance"

The error tells you that there is some attribute of some Entity Relationship that has an invalid layering but it only gives you an ID of that attribute and not the name, so the only way to find out which one it's referring to is to login to the SQL server and run a couple scripts. The first thing to check for this particular error is to make sure that someone has not exported and imported a solution that includes unmanaged components that we work with (Account, Lead, Contact, or Marketing List or any of the ClickDimensions entities). This causes invalid layering of solutions and is not allowed by CRM.

If that's not the case then there is some database issue. Recently we’ve come across this error when customers have CRM Update Rollup 16 loaded for CRM 2011 or have upgraded to CRM 2013 but had UR16 loaded before the upgrade. There was a Microsoft bug in UR16 that caused managed solutions like ours to fail to import so this could be related. In this case we have to find which attribute it’s referring to in the database. Run the following SQL script for the CRM database:

Select * from MetadataSchema.Attribute
Where AttributeID like ‘%id-of-attribute-in-error-from-import-log%’

Here’s a screenshot from SQL Server Management Studio that shows how to initiate the query:

SQL_screenshot update

This should return the attribute name. It will also return an EntityID column with a value. Get the value from that column and use the following script to find the entity that the attribute is related to and place that value like below. This will tell us which entity that attribute is related to:

Select * from MetadataSchema.Entity
Where EntityID like ‘%place-entity-id-here%’

This script will return the actual relationship in question. Now you know the offending attribute and you can move forward with troubleshooting! Next possible steps in this case could be removing the offending attribute from the UI or maybe removing the reference to it from the solution XML.

Have more questions? Submit a request


Article is closed for comments.