6

I don't think there is one answer to this problem but at the same time I don't get what Microsofts expectations are.

Facts:

  • Workflows log to the history lists.
  • This list shouldn't be assumed or used as an audit list.
  • Workflow instances are cleared via a cleanup job (60 day default) but the workflow history list items are not cleared.

This is all good but I've just recently moved a site from SP2007 to SP2010. Due to the workflow history list having 5000+ items in it the UI when viewing details of a workflow shows an exceeded error. This is daft! Even changing the views to limit the items don't help this UI. Only fix is to change the throttling setting in Central Admin for that particular web application.

I want someones take, specifically MS's on this. Is it your intention we should purge this list or something? If so we need to make sure we only do it for lost workflow instances. Why this part of the UI cares for the total items in the list seems daft, surely its a "select * from where instance = guid" (few items returned).

What options do I have. Write some wacky timerjob to purge cleared items or changes a global setting. Eventually ALL workflow history lists will exceed the limit if they are not maintained.

Please give your thoughts. I realise there isn't just one answer.

1
  • After looking at the implementation using reflector it seems although the SPQuery is created with filtering for the current WF instance this SPQuery for one reason or other is never used. Instead the default view is used, of which returns all items, this is the default view for the web part and not that of the list view it self hence changing that view on the list has no impact either! Are any Microsoft representatives on here to share their comments? This surely has to go down as a bug?
    – Tezza
    Nov 14, 2011 at 13:12

4 Answers 4

3

There is a tool to cleanup the workflow history list on the msdn site: http://code.msdn.microsoft.com/Cleanup-Workflow-History-cee6e75e You could tailor it to your needs, or you could simply create a scheduled task to run it periodically.

Take note about the timing and monitoring of this tool (esp. while the list is large) to prevent your trans log growing too large and not impact search crawls.

Interestingly the description points out as you say that there is an outstanding issue with MS that the workflow history list does not get purged. (issue notice dated as Sep 2011).

One reason I can see MS dragging their feet on this is that although one should not use the history list as an audit log, it is commonly used as such. Still the option should be there.

2

SharePoint Workflow history list never gets deleted - That is the topic of my post below. http://allaboutmoss.com/2011/11/21/sharepoint-workflow-history-list-never-gets-deleted/

In the post you will have a clear view of how workflow history lists are maintained in SharePoint.

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

Do not miss out the msdn post at the end, where a CleanupWorkflowHistory.exe has been developed to clear these tasks list explicitly.

1
  • 2
    Why are you telling me what I have already stated. I realise the history items do NOT get deleted hence the issue. Look at bullet point 3. The exe is not an option because it just 'clears', it has no respect of currently running workflows which may span years. If a workflow instance is running then I want the associated history regardless of time span.
    – Tezza
    Dec 13, 2011 at 10:10
1

I'm having the same issue with migrating from '07 to '10. I'm testing what I think will be a workable solution: I've created a retention policy for the workflow history list to delete an item after 90 days. I believe the clean-up job to apply the policy runs nightly so I'll see tomorrow if that's worked and deleted unnecessary records.

3
  • Although considered this is still not an option. The clean up job only 'cleans up' workflow instances which are complete/finished. If a running workflow instance spans a year then I want the associated history to be available! A retention policy would not respect 'still running' instances.
    – Tezza
    Dec 13, 2011 at 10:13
  • Update: This worked as expected/hoped; over half the entries were removed, bringing the entire Workflow History list size below the 5000 entry limit.
    – Shawn
    Dec 13, 2011 at 12:58
  • Yes, that would be a limiting factor. Workflows in my situation run for a couple weeks maximum.
    – Shawn
    Dec 13, 2011 at 13:00
0

When a list exceeds the 5000 item view threshold, you must index a column in that list and use the indexed column as the FIRST filter in your view of the history list.

I just had to do this today when my tasks list exceeded 5k items. I created an index of the Status column, filtered the view by Status not equal to Completed and was able to see a list of items again. Without the index, I would continue to get the error you mention. 5000 items is a lot to show at once and the query alone can not only bog down the list view, but your site as well.

1
  • 1
    Changing the default view or adding another view to the history list helps when viewing the items in the history list but it does not aid the workflow status page. To me this is a fault in the page itself. It should be querying a subset which matches the instance only and therefore not returning no where near the item threshold.
    – Tezza
    Jan 19, 2012 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.