Skip to main content

Hi Guys,

my name is Ollie and I'm working since a half year with Nintex Workflows and Forms .I like them, but I'm tired of clearing the History every week. Especially when using the "Filter" actions the History is getting full and the WFs are getting in stuck.
So I couldn't find s.th how to clear the history automatically, i decided to make a Workflow clearing the History automatically (may be there is somewhere a tutorial but i didn't find it!?).

 

Now that is I made it with an time scheduled Workflow:

 

1. Create an new Site Workflow with the following Variables:

   - List_Collection

   - List (String)

   - Yesterday (Date)

   - ID_Collection

   - ID (String OR Number)

   - Index (Number)

 

2. Now that is how you should arrange the Items in your Workflow

 

3. Now you should go to the calculate Date and Calculate how Old the Entries should be to be deleted


4. Go to " 'Site Settings' --> 'Manage workflow history lists' " (or you can type into your Browser "YOUR TEAMSITE/_layouts/15/NintexWorkflow/ManageHistoryLists.aspx") and copy the History List Name from these Lists you want to delete automaticaly like shown into the Regular Expression.

 

 

5. Create a For Each Loop through the List_Collection an store the Value into the String-Variable List

 

6. Now it's getting tricky, build the Query with the CAML editor

When you Copy this Query the Workflow will store all ID's into the ID_Collection from entries older than 1,5 days (or how ou had set it up before in the calculate date). Please watch out that everything should be same like shown above, especially with the "List Title" (by default it's "List ID"). If you want to query another field than Modified or Created dont't forget to change the Value Type. To avoid Problem with the Query on List with more than 5.000 entries put the <ViewAttributes Scope="Recursive"> flag to your Query.

 

7. Optional: Count the Amount of Value's in the ID_Collection an store the Value in the Index variable. Now build a Runf If and here you can define how many Value's there should be in a list for minimum to delete. Put the loop from the next Step inside this Run if

 

8. Build a For Each Loop from the ID Collection and store each value in the ID Variable.

 

9. Now we need the Delete Multiple Values action and use there the CAML editor too.

Type in the Query exactly like shown above.

 

Now that's it from building the workflow. Now you can publish it and add as a time scheduled workflow.

You'll never have an overfilled History again.

 

 ____

 

Of course you can query by other values too. I'm often using the filter action, wich can't hide from the history. So I make a query by "The item under workflow did not meet the filter criteria." from the field "Description" too.

Heres is this Query-example

 

Please let me know if this tutorial was helpfull for you. If necessary I can make some several other tutorials too.

If yout got some Questions please put it in the Comments.

 

With Kind Regards

Ollie

Hi!

I don't know what version of SharePoint you are using, but why don't you gave a try to retention policies in settings? https://support.office.com/en-us/article/Create-and-apply-information-management-policies-eb501fe9-2ef6-4150-945a-65a6451ee9e9 ? The operation you are taking care by using your workflow is err.. OOTB in SharePoint

Regards,

Tomasz


Hi Tomasz, how can i apply these setting for the Workflow History?
I found it only for the normals lists


Hmm... I double checked, but as the Workflow History list is just another type of a list, "Information management policy" should be available for you as well:

Regards,

Tomasz


Be sure, you have the "Site Policy" Site Collection feature enabled:

Regards, Tomasz


You might want to check nwadmin.exe on the server. You could write a powershell script to clear the history list data as well as purge workflow data. Check out the docs at https://community.nintex.com/docs/DOC-1026-nwadmin-operations-nintex-workflow-2013

To automate things, you could execute the script as a scheduled task.

This only works on the server though, but could be more performant than a workflow.


Reply