SharePoint and the Vanished Workflow History

Workflow history is useful – especially in an enterprise environment. Think of important documents that need to be approved before they get published. In most cases a content approval workflow is used to accomplish that.

But the approval workflow is not only use to approve a document. It’s workflow history is used to record who has taken what action on the way to approve (or to reject) a document.

Let’s have a look on the following screenshot:

Workflow History

I just created a very simple scenario here. You can see that DemoUser has started the approval workflow and that the Administrator has approved the document (Ok – not a real world scenario, I must admit that). In most enterprises the item’s Workflow History is also used to save -or let’s better say- to archive the steps and the involved users that marked a document as ‘Approved’.

Deploying Workflow Manager - Paolo Pia

 But this archived item’s Workflow History is not existing forever – as you might expect!

As you can see in the above screenshot a workflow history can contain a lot of data. Workflow Histories can get large – especially when a workflow consists of many steps or actions.

To prevent bottlenecks and slow performance Microsoft has created a Timer Job that is used to remove items’s workflow histories in case their completion date is older than 60 days.

image

Let’s have a look on the Timer Job settings:

image

Let’s have a look on how a user sees the whole process:

This is how the document item looks like after it has been approved:

image

And this is the item’s Workflow History:

image

Here you can see that DemoUser initiated the approval workflow and that the administrator approved the document just a few minutes later.

And this is the task that has been created:

image

Let’s assume the Workflow Auto Cleanup Job has been triggered and it deleted the document’s workflow history. This is how the library and the Workflow Tasks list look like after the timer job has been finished:

image

image

The field Approval is empty and the document’s workflow history is not existing anymore.

By default the SharePoint Server uses a 60 day retention. To change that you need to modify a property of  the workflow association.

For this blog post I have created a simple feature that changes the value for ‘AutoCleanupDays’. Please feel free to use or modify this snippet to increase the days the workflow history is kept in your environment.

image

But what about the list that stores the Workflow History items? This list is hidden by default, so we need start SharePoint Manager to unhide the list Workflow History first.

image

image

This is how the list (and the corresponding item) looks like:

image

As you can see the history item that corresponds to the last approval is still there (have a look at the timestamp: 18:30 – that’s the time when the administrator approved the item). The items in this list are linked by GUIDs to the parent list and the parent workflow. Looking at this item you still can see that the corresponding item has been approved. You also can see the timestamp of the approval. That means that the primary information (the document has been approved) is existing even after the Workflow Auto Cleanup-Timer Job has been deleted the item’s workflow history.

The bottleneck that Microsoft is afraid of is the Workflow Tasks list getting bigger and bigger. The Workflow Tasks list is a list that is often accessed and the more items are stored the slower the access gets. I think that’s why the Workflow Auto Cleanup-Timer Job had been introduced in SharePoint 2007.

If the item’s workflow history should not (or never) be deleted, there are to ways you can go:

disable the Workflow History Auto Cleanup-Timer Job, but keep in mind that this will be more far-reaching than you intend.
– use the code snippet from above to increase the retention days for the libraries that should keep the item’s workflow history for more than 60 days.
– use this PowerShell Script to increase the retention days.

If you have any feedback or questions for Oliver please leave a comment below.

Deploying Workflow Manager - Paolo Pia

Oliver WirkusAbout the Auhtor: Oliver Wirkus is Senior Consultant at the IT consulting company Bridging IT GmbH in Mannheim/Germany. As a SharePoint expert and software architect he has long standing experience in conducting international projects. Customers from different industries like power suppliers, pharmaceutical and financial companies rely on his knowledge as a SharePoint expert. Oliver Wirkus has published several professional articles, is a renowned speaker at conferences and maintains the well known SharePoint blog (http://sharepointcommunity.de/blogs/owirkus).

 

Would you like to become a full community member and have access to more great content such as eBooks, webinars, presentations and how to videos? Then simply click here to join the community.

It only takes a minute! 🙂

Latest blogs:

Share this on...

Rate this Post:

Share: