Site icon @WonderLaura

SharePoint Workflow History Issue

As you may know, in SharePoint there is a built in “Workflow History” list that exists on each site where you use workflows, and the workflow information for all workflows automatically gets written to this list behind the scenes.  This is a hidden list, but you can see it by going to this URL:

/yoursite/lists/workflow%20history

I don’t suggest messing with it, except maybe to create views to filter for troubleshooting.

In several different SharePoint 2010 sites for different clients that I work with, I’ve noticed that a weird, extra workflow history list sometimes exists in a site, and it’s called “1 History”, and the URL is:

/yoursite/1%20History

Notice the big difference in the location of these two lists.  The first is in the correct place, and this second one is not under lists where it should be, but directly under the root of the site.  This is something that I had noticed in passing, but it didn’t really affect me… until…

I tried to save a site as a template, and got this error:

Error exporting the list named “1 History” at the URL: 1 History

ch5[167]

That’s a problem.  It looks like I can’t save a site as a template if this 1 History exists.  That’s not exactly the case, though.  I’ve been able to successfully save other sites as templates where this same list exists, but the problem in this case is that the list has over 7,000 items in it, and even though I didn’t check the box to save the list content as part of the template, I still got the error.  It appears as though the NORMAL workflow history list DOES keep itself cleaned up and old items are automatically deleted.  This other “1 History” list doesn’t seem to self purge, which is probably why it has so many thousands of items.

First thing, I don’t want to immediately delete this list, I need to go in and configure all of my workflows to write to the correct history list.  Here’s how:

  1. Open each workflow, and look at that main workflow settings screen.
  2. Notice the Settings section at the top right:
    If your workflow says “1 History” here, change it to the correct one “Workflow History”, and click through the verification prompt.
    (Note that I’ve also seen this happen with the tasks list, with a rogue “1 Tasks” list)

  3. Re-publish the workflow.

From that point on, that workflow will then write to the correct workflow history list when it runs.  The thing is, any workflows that you have that are still currently running will still be writing to that old list.  How do you know which workflows are currently running?

In SharePoint Designer 2010, open your site and click Workflows on the left.  There are all of your workflows on the site.  Click the name of each workflow to see which list or library they’re associated with.  On each list and library that has a workflow (where you had to fix the history list), do this:

  1. In the list or library settings, click Workflow Settings.
  2. This will show you a list of all of the running workflows for that list:
    Note: It’s important to understand this screen.  Each time you publish a workflow, it gets saved as a new version in this list.  You’ll notice that workflows that are “In Progress” (or stuck) will count here as the number in progress.  I recommend that you periodically go in here and click Remove a workflow and remove all of the ones that say (previous version) next to them with zero workflows in progress.
  3. Go to the list now, and create a view that has the Name of Workflow column displayed.  There will be a column name for each workflow in the list.  When you see that column, it will show you exactly which items in the list have currently running workflows.
  4. Click the link on the name of the status of each workflow to see the exact version that’s running, with all the details.

Basically, if all of these running workflows are legit, then you really are just going to have to wait until all those old versions have completed, before you can delete the “1 History” list, because those old workflows will still write to that list when they complete.

When it comes time to actually delete the “1 History” list, more issues.  Since in my case, this list was over 7000 items, I got an error:

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.

I also tried changing the default view to not show any items, tried deleting it from within SharePoint designer, tried going into datasheet view to delete items that way, and I think I even tried to delete it from explorer view.

Last resort.  I asked my co-worker Todd Klindt how I could go about getting rid of this list by using PowerShell.  He wrote a script for me, and he also ended up writing a blog post about how to delete large lists, here:

How to delete a large list in SharePoint 2010

If you’d like to read more that I’ve written about SharePoint workflows, you can click the “Workflows” category on the left side of my blog.  Also, in my book, one of the chapters that I wrote is the one called “Working With Workflows”.  The book is Beginning SharePoint 2010: Building Business Solutions with SharePoint.


Exit mobile version