Applies To
Dynamics 365 Customer Engagement (on-premises)

Symptom

When upgrading from Microsoft Dynamics 365 8.x to Microsoft Dynamics Server Version 9.0 for on-premises, the following error is occurring.

Exception occurred during Microsoft.Crm.Tools.Admin.OrganizationUpgrader: Error.ActionFailed Microsoft.Crm.Tools.Admin.OneTimePostAppsInstallUpgradeAction

Furthermore, reviewing the upgrade log file crmdmsnapin.log, we see the following full context of the error message.

Error| Installer Complete: OrganizationUpgrader - Error encountered Error| Exception occurred during Microsoft.Crm.Tools.Admin.OrganizationUpgrader: Error.ActionFailed Microsoft.Crm.Tools.Admin.OneTimePostAppsInstallUpgradeAction InnerException: Microsoft.Crm.Metadata.EntityMetadataNotFoundException: The entity with ObjectTypeCode = 0 was not found in the MetadataCache. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=748967650, MinActiveRowVersion=748967650    at Microsoft.Crm.Metadata.DynamicMetadataCache.GetEntity(Int32 entityCode)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.LegacyListExecutionParams.ToUpgradedParameters(EntitySerializer serializer, BusinessEntityToEntityConverter businessEntityTypeConverter, ICrmConversionContext conversionContext, ExecutionContext context)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.ProcessListBasedBulkOperation(BusinessEntity entity, ICrmConversionContext conversionContext, ExecutionContext context)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.ProcessEntity(BusinessEntity entity, ICrmConversionContext conversionContext, ExecutionContext context)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.ProcessEntities(BusinessEntityCollection entities, ICrmConversionContext conversionContext, ExecutionContext context)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.RunUpgrade(ExecutionContext context)    at Microsoft.Crm.SE.DatabaseActions.DllMethodActions.UpdateBulkOperationParametersAction.Execute()    at Microsoft.Crm.Tools.Admin.OneTimePostAppsInstallUpgradeAction.Do(IDictionary parameters)    at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteActionHelper(CrmAction action, IDictionary parameters, Boolean undo)

Cause

One possible cause of this error is that there may be bulk operations jobs that have not completed or are in a pending state.

Resolution

To verify if this issue is caused by unfinished/pending bulk operation jobs, run the following SQL query against your OrgName_MSCRM database.

SELECT StateCode, ActivityId, CreatedOn FROM BulkOperation WHERE StateCode NOT IN (1,2)

If the above query does return any results, these bulk operation jobs will need to be allowed to finish or they will need to be updated to a state of 1. For example, the results of the query would display something similar to below.

StateCode

ActivityId

CreatedOn

0

72BB4074-A3EA-D311-82E6-2213V23D9E50

2009-12-16 23:19:27.000

 

To correct the issue for these particular results, a SQL update will need to be run. The update statement is listed below.

UPDATE [BulkOperation] SET [StateCode] = 1 WHERE [ActivityId] = '72BB4074-A3EA-D311-82E6-2213V23D9E50'

Once the above update has run, start the upgrade to Version 9 again and it should complete successfully.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.