Generic errors while importing solution in Dynamics CRM 2016

While importing an update for a solution or a new solution that is building on top of another solution, then you might face generic error messages. This blog post provides a possible solution for the scenario when the CRM solution import dialog mentions a "Generic SQL error" while downloading the log file serves you the message "0x80044150: Object reference not set to an instance of an object.".

I have found that for some reason it is possible that the Description attribute of an entity is not included in the customizations file when exporting from Dynamics CRM 2015. If this is the case, then the system will crash during import when it tries to determined if the LabelDescriptionHasChanged.

You can confirm that this is the issue by running the following SQL script:
SELECT objectcolumnname, s.FriendlyName 'Solution FriendlyName', label, objectid, LanguageId
FROM [LocalizedLabelAsIfPublishedView] l
LEFT OUTER JOIN solution s ON l.solutionid = s.solutionid
LEFT OUTER JOIN entity e ON l.ObjectId = e.EntityId
WHERE = 'new_entity'

Of course you'll need to change the new_entity to the schemaname of your entity. If this query results only the LocalizedName and LocalizedCollectionName but no "Description", then this is could very well be the cause of the error messages. Another way to confirm is to check the customizations file, search for the entity and determine if the tag <Descriptions> is present.

The way to solve this is quite easy. In your source system, go to the correct entity, add a description and export the solution again. You will need to remove the previous solution from the target environment though.

Workflow With Id = fe31a1bb-949e-e511-80c3-0050569c18ec Does Not Exist

Similar to some of my previous blog articles, there can be some leftovers which limit you in removing a solution from your organization. This article helps you in determining the cause of the error when you face the following error.

ErrorCode: -2147220969
Message: Workflow With Id = fe31a1bb-949e-e511-80c3-0050569c18ec Does Not Exist.

Most likely there is a process, not necessarily a workflow, which hasn't been removed completely. The following query will help you identify which process is causing the error:

select label from LocalizedLabel where objectid = 'fe31a1bb-949e-e511-80c3-0050569c18ec'

Obviously you'll need to replace the objected with the guid from the error message.

Once you have found the culprit, then you can try to remove the process by using the CRM UI:

- Go to advanced find
- Select the entity 'processes'
- Remove the default query
- Select 'name equals' and paste the name that you retrieved from SQL
- Remove the returned records from CRM

You will want to avoid removing records from the database as much as possible as this generally causes more errors instead of solving them.

Note: I have found this problem to occur in CRM 2015 update 0.1, this might be fixed in CRM 2016.