SharePoint Workflow History “Disappears”

By default, workflow history will "disappear" after 60 days.  Microsoft has built this into MOSS intentionally to ensure good performance.  By deleting old workflow history, it’s more likely (but hardly guaranteed) that the Workflow History list (/Lists/Workflow History by default) will stay below the magic 2000 items per list limit.  (See the "Working with Large Lists in Office SharePoint Server 2007" white paper for details on this limit.)

The official Microsoft answer to this in Technet is to disable the Workflow Auto Cleanup Timer Job.  Unfortunately, this is a farm-level setting and will affect every Site Collection in your farm, which may be more far-reaching than you intend.  However, it might be the right solution for you.

Another option is to run some code to change the time length for the history retention.  There is some good code and discussion here (I’m reproducing the code below in case the link changes.  Thanks to Shola Salako!  I haven’t tested this code, so use it carefully.) to do this by changing the value of SPWorkflowTemplate.AutoCleanupDays on specific lists.  NOTE: Don’t use the SQL method!  Running the C# example which utilizes the object model is perfectly legitimate, but poking around in the database will leave you in what Microsoft calls an "unsupported state" and is just a bad idea.

For companies that rely on workflow history for auditing and regulatory compliance, taking one of these actions is going to be critical.