CRM 2011 Errors with State Code or Status Code is invalid when deleting a managed solution

CRM 2011 Errors with State Code or Status Code is invalid when deleting a managed solution

After importing a managed solution and making changes to the environment by removing some of the out-of-the-box views for the Contact or Account entity, we encounter an error if we ever try to delete the managed solution. The error is “State code or status code is invalid” or 1 is not a valid status code for state code…”

After importing a managed solution and making changes to the environment by removing some of the out-of-the-box views for the Contact or Account entity, we encounter an error if we ever try to delete the managed solution. The error is “State code or status code is invalid” or 1 is not a valid status code for state code…”

The solution is pretty straight forward. Before trying to delete the solution:

  • Open the default Solution
  • Navigate to the Views of the Account entity
  • Make sure that there are no system views under Inactive Views. If there are, Enable then
  • Repeat the same for the Contact entity
  • Publish your customizations

Now you should be able to delete the managed solution.