Calculated Fields and Managed Solutions

We are supposed to be able to uninstall a managed solution when no other solutions or unmanaged layers are dependent on components within the solution that’s being uninstalled - but alas this is not true when calculated fields are used.

Finding this issue in a much larger solution required Microsoft support to assist with the diagnosis because the error messages shown below were obscured by timeouts in the solution engine.

Minimal Demonstration

The example below is a minimal demonstration - a single solution containing one table with two added columns: a lookup (relationship) and a calculated Yes/No.

Solution: CalcFieldMinimal

  • Table: ‘SurveyLine’
    • Fields
      • ‘Contact’ which is a lookup to the standard Contacts table
      • ‘Alert’ which is a Yes/No calculated column defined as:
        • = if ‘Contact’ contains data then set to ‘No’, else set to ‘Yes’ These are shown below:

These are shown below:


Columns in the Survey Line table

Alt Text

After exporting the solution as managed and importing it into another environment the solution will fail to uninstall with the error: Failed deleting solution. Sql error: Generic SQL error. CRM ErrorCode: -2147204784 Sql ErrorCode: -2146232060 Sql Number: 5074" as shown below

Uninstall fail

A more detailed error is shown in the solution history:

Solution History Error Message


To resolve this issue Microsoft support state the lookup must be removed from the formula via a solution upgrade, after which the (upgraded) solution can finally be uninstalled. If the managed solution is provided by a third party then this may be problematic at best.

Condition Removed


  • Calculated columns referencing lookups can cause managed solutions to fail to uninstall.
  • The workaround is to upgrade to a later version of the solution where the lookup has been removed from the calculated column and only then uninstall the (upgraded) solution.