How to Fix a Failed to Upgrade Async Operation Records Error

Arpit Malhotra, 29 June 2018

Recently, while working on an upgrade from Microsoft Dynamics CRM 4.0 to Dynamics 365, I came across the below error while importing the CRM 4.0 organization database into CRM 2011:

image

The error was resolved by obtaining the errored GUIDs of the workflow instances (system jobs) from the MSCRM error log file. An instance of the affected GUID in the log file is as below:

image    
We acquired all the workflow instance GUIDs from the log file and deleted them from the AsyncOperationBase table in the database. The constraints for the WorkflowWaitSubscriptionBase table must be disabled before executing the deletion query. Remember to enable the constraint after.

Warning: Before running the deletion query, please discuss with the business as the system jobs sometimes have business value and therefore have to be stored for a long period. In our case, the affected workflow instances were created a few years back and were set on the 'Waiting' status while it's regarding object was set to 'Completed' and thus, we decided to delete those.
 
Please note that this is an unsupported fix but will let you proceed with the import to the CRM 2011 organization, moving you forward towards your upgrade to Dynamics 365.

image