Posted on:
Categories: SharePoint
Description:

By default SharePoint is configured to remove the workflow history from an item 60 days after the completion date of a given workflow. This might not be an issue under normal circumstances; however, we started to receive reports from some business groups indicating that they needed the workflow history for legal auditing purposes.

I was pleased to discover that SharePoint doesn't actually delete the workflow history for a given item, it just unlinks the item from the workflow history. At this point I began searching for options that might enable me to reconnect each item to its respective workflow history. The solution came in the form of a calculated column.

The strategy would be to create a new column that would contain a link to the relevant workflow history for each item.

The workflow history list provided me with everything that I needed to uniquely identify each item and its workflow history. Here is the query that I ended up using to create a link back to each items' workflow history


=CONCATENATE("<a href='https://site.contoso.com/sites/sitename/Lists/Workflow History/Audit View.aspx?View={7B4903D7C0%2DE871%2D462A%2D9D60%2D89A7E8B68901}&FilterField1=Item&FilterValue1="&ID&"&FilterField2=List&FilterValue2={3a7dd990-fc6c-459b-a341-ac0bc7ab46a8}&FilterField3=WorkflowAssociation&FilterValue3={
0ca99fcb-3e3b-4ce4-ae21-44e627959fee}')>Internal Approval Workflow History</a>")

This query string filters for the item ID, List ID and Workflow Association ID. This results in a clean display of the workflow history for each item.

I created a new view in the workflow history list called 'Audit View', which contains the relevant fields that would be useful for auditing purposes. The query references the List ID as well as the workflow association ID. In this case we had several workflows associated with the list, so it was important to distinguish them.

The end result is a column with hyperlinks to the workflow history for each item.

*When you create the 'Audit History' calculated column using a 'Date/Time' data type this will justify the link text to the left side of the column