Tag Archives: workflows

SharePoint Workflow history list never gets deleted

This post will help to understand the different issues and solutions with workflow history stored in MOSS 2007 and SharePoint 2010.

There are organizations were numerous workflows are created that are developed using, either out of the box features or SharePoint Designer or Visual Studio developed or even third party tools like Nintex or K2.

What is a workflow ? - A workflow is comprised of a sequence of events such as workflow initiation, task creation, and task completion. When you add a workflow, you specify a task list and history list that workflow instances of that workflow association will use to track the events for the workflow. The task list contains the items that users interact with and enter data into while interacting with the workflow. The workflow history contains key information about each event including date, status, participant, and description.

Workflow history list – This is a hidden list in all SharePoint sites and this could be accessed by appending /Lists/Workflow History/ to the address of the SharePoint site. Many of the organisations would like to keep these lists as long as possible to maintain as a backup for the workflows created. But what about the bulk amount of database space that it occupies?

Workflow Auto Cleanup timer job – The Workflow history list is deleted by default using the Workflow Auto Cleanup job. This job should delete all workflow instances and related task entries that exist 60 days after the workflow is completed or cancelled. Thank God!!! All those unwanted entries could be deleted automatically by running the timer job. If you wish to keep the workflow history list, it could be done by disabling the timer job. Go to Central Admin -> Operations Tab (SharePoint 2007) -> Timer job definitions -> Find the timer job, click open and just disable.

There are also patches available from Microsoft technical support to increase the number of days from 60 to a larger number, thus increasing the amount of time that the workflow histories could be retained - http://blogs.msdn.com/b/nishand/archive/2007/09/10/changing-the-spworkflowassociation-autocleanupdays-property.aspx

Workflow history list never gets deleted

Wonder why the database space is still getting eaten up even though the workflow history list are scheduled for auto cleanup. Recently there was an msdn post which described that even though the timer job is enabled, the Workflow history lists are infact not getting deleted. As the post explains, Workflow history items themselves are not deleted, but the entry point to view them on the status page for a particular instance will no longer be available.

The post has a code sample that could be used to actually delete all the Workflow history list items. Those who would be running workflows on K2 or Nintex could also check with the vendors, how these lists are managed by them.