Monday, January 9, 2012

Workflow Debugging - CRM 4.0 vs CRM 2011

In CRM 4.0 debugging workflow errors can be a pain.  If you browse to the system job record, it is in either "Waiting" or "Failed" status.  Opening the record in hopes to find more details just provides you with the infamous generic error "An error has occurred.".  A pro tip if you are in this situation is to run this SQL query against the organization database:

select Message from AsyncOperationBase
order by CreatedOn desc

This will display all the system job records in order of most recent.  The Message column will contain a more detailed error which is very helpful in troubleshooting the workflow instead of the generic error you see in the UI.

For example I have a workflow that executes on status change of a Task and the workflow will try to update that Task record.  When I close a task this workflow will execute and fail.  I can dig into the database by running the SQL query from above to find this very helpful message:

This tells me exactly what the problem is without having to troubleshoot blindly.  Since my Task is being closed it kicks off my workflow which tries to update the Task record but the Task record is in Closed state so therefore it cannot be updated.

In CRM 2011 Microsoft provides us with a nice UI on the system job record that tells us exactly what the error is and also provides the full stack trace in the Details tab.


  1. very nice observation.
    at least the 4.0 exercise is healpful :P

  2. hi,

    instead of going db, u can get the "message" from the advance find and edit the view by adding the column...
    so better use the advanced find, as the column is exposued for use...