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)

    ch5[168]
  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:
    ch5[169]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.
    ch5[171]
  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.

ch5[172]

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.

13 comments

  • Thank you for sharing this valued information, I faced the same issue with large scale farm which has huge workflow instances and tasks and we’ve planned the following: – Develop timer job to archive all the items which has workflow with compacted status and older than 2 months -> to external site. – Then we have to remove all the workflow history + compacted tasks + items related. So, I will conceder your experience with removing large lists items. Megren.net

  • You can also delete the list through SharePoint designer, so as much as I love a good PowerShell you can save time that way.

  • Hi. I’m working through your book, chapter 5 and I’m stuck on the Creating a SharePoint Designer Workflow step 22. I’ve created the two lists but when changing the data source I do not see the Store Items list in the drop down. Any ideas as to why this is happening? Besides this I’ve really enjoyed the book and think the approach and material covered is spot on.

  • Les, You may have to hit the “refresh” button in sharepoint designer, so that it will recognize the new list you created.

  • Thanks Laura for this valuable information. I was wondering what causes the creation of “1 History” list. Jay http://codeforfuture.com

  • Jayvardhan, I don’t know the answer to why/how that list exists, but I have seen it happen in a couple of different environments.

  • Hi, when I published my workflows and created new items, the workflow status columns were not being added to the Allitems view. Do you know why this happened and from where could I pull those columns to be displayed in my lists? Any help is really appreciated. Thanks

  • Hi Laura,
    The first time a workflow is run, that workflow column gets added to the default view of whatever the list or library is. Is AllItems.aspx your default view? If you need the missing column from any view, just go modify the view and put a check box next to the column that has the same name as your workflow.

  • Hi Laura,

    Yes is my default view but when I go to modify it, the columns (called as the workflows name), don’t appear to put the check box next to. I’ve tried to find them along all the site and other views but I haven’t success. Any ideas in how can I find them or fix this issue? Thanks!

  • Hi Laura,
    That’s weird. I think one thing you may want to try, is this:
    Go to the list/library settings and click “workflow settings”. Remove all copies, even the current one, of that workflow.
    Re-publish the workflow, and see if the column shows up.
    Important note: If your workflow has ever assigned tasks to anyone, removing those old versions of the workflow will also remove all those tasks. I learned that the hard way. 😉

  • Brad McKendry

    Hi Laura,

    I made a change in Central Admin to my workflow settings:
    “Allow external users to participate in workflow by sending them a copy of the document” from no to yes, then back to no. Since I made this change, I have this annoying (Previous Versions, date, etc…) after the column name for Workflow status on my list and it makes the column width take up half of the page. Do you know how I can get rid of this?

    Brad

  • Russell Wright

    Laura, you have great posts and write about the weird stuff that never happens to the MS folks…only us trying to use the product. 😉

    I also have had the 1 History list show up…with over 211,000 items in it! This is most likely because we had the SP admin turn off the task and workflow history cleanup/purge job. We did this because one of the guys felt it was needed for some metrics (even though the data is captured on the original list…he didn’t really understand this).

    We start a monthly WF that loops and actually starts about 800-1000 workflows and it has been running fine for the last 4 months. Now we are getting the infamous “The task is currently locked by a running workflow and cannot be edited.” It looks like I’m going to have to create a new task list for our workflow to use (Collect data from a user). Have you any idea on how to troubleshoot an error like this? There’s not much in the ULS logs at the correlation ID marker. Got any insight on how to find out what is “locking” the task?

    It’s a long shot, but I thought I’d ask.

    Russ

  • Brad,
    Sorry I’ve never seen this happen. That seems to be in the realm of something that an admin-type person may be able to troubleshoot, though.

    Russell,
    I’ve seen the “task is currently locked” issue, and it has been the bane of my existence a couple of times. Be sure not to create any workflows that run off of the task list, that can cause problems like that. A couple of times, I think the workflow had just gotten corrupted, so I recreated the same workflow from scratch and had no problem. My overall solution is to completely avoid assigning tasks from workflows altogether. Instead, I use “create list item” action and create tasks that way. It takes more work and customization to the task form to get it to look right, but will save you much pain in the long run.

Leave a Reply