Tip 27: Workflow Overflow
This tip is for Windows SharePoint Services 3.0, Microsoft Office SharePoint Server 2007 and may apply to SharePoint Foundation 2010 and SharePoint Server 2010.
There is a hidden list in SharePoint called Workflow History. This list is hidden from the “View All Site Content” and the “Manage Content and Structure” pages but you can browse to it and view information on running and completed workflows. The list is located at http://site/Lists/workflow%20history. Whenever a new workflow is created using the default history list, the workflow writes information to this list. Since workflows can write many items to the list whenever a workflow is ran, you can imagine that it can grow fairly quickly. Since the workflow history is a list, it is also bound by capacity guidelines on list size. This means that after about 2000 items per level/view in the workflow history list, the list performance will suffer. The best way to mitigate this is to create a new workflow history list when a new workflow is created. This way the workflow information is spread out between more than one list. The way to create a new workflow history list for a workflow will very between the various workflow types, the Web GUI can be used to change the workflow history list when creating a new workflow instance based on one of the feature workflows like Approval, Three-State, Collect Signatures, Collect Feedback and Disposition Approval. To create a new workflow history list in the Web GUI go to the list/library settings->Workflow Settings->Add a workflow. Select “New history list” from the History List.
After running a workflow with a new history list, a new list will be created with the following format; <Workflow name> History. So if I created a workflow called Approval1, and selected new history list; then a list called Approval1 History will be created.
In workflows created with Visual Studio with VseWSS installed, if the “Auto Associate” property is set to False for the project, then you will use the same steps as above to create a new history list. You can also run through the “New Office SharePoint Workflow” wizard by selecting the History List property and click the … button.
New Office SharePoint Workflow wizard
Workflows created in SharePoint Designer will write to only the Workflow History list. There is not any way to change this. So in this case, the only thing that can be done to keep the item count of the Workflow History list down is to trim the list in datasheet view manually. Deleting history items that are older than 60 days would be a good start, or create a program that will delete the items that can be scheduled with Task Scheduler.
So the take away from all of this is that you want to keep each workflow history list under the 2000 item limit so that the performance of workflow and the Workflow Auto Cleanup timer job stay within acceptable levels.