Saturday, June 29, 2013

SharePoint 2010 – Workflow History


SharePoint 2010, has a powerful feature called Workflows. I am sure you have heard about it. It is a feature which depending upon your programming intellect, can be used in the out-of-the-box mode, or you can write complex codes and routines to fulfil your heart’s desire.


I would call myself an average programmer (yes I am being modest), who prefers to find the easiest and quickest way of doing things. Therefore I designed some workflows in my current position. However if you know anything about programming and all things linked with it, you would also realize how important is the word troubleshooting. You write a nice bit of code and everything is running fine till one fine Monday morning you suddenly realize oops.

Yes that’s where troubleshooting comes in and troubleshooting a workflow can be a pain as well. Since everything is fine in your code (you know that’s not true but that is what you tell your boss, right?), but somewhere something is not working as you wished it to be working as.

Well you cannot teach someone how to troubleshoot but you can share some secrets.

So in this blog I will share some details of a very important table called ‘Workflow History’ and some small details of places where you, starring as Sherlock Holmes, can discover some clues to point you in the right direction.

Workflow History Table
Whenever a workflow is executed on your team site, there is one hidden list where SharePoint records some important details about the execution of the workflow. That table is called ‘Workflow History’. Wait wait, don’t run to the list of your site content, since as I said that this table is Hidden, therefore you will not find it there. There are different ways to unhide, and you can ask Mr. Google about that, but the best and most simplest way to access this list is to append ‘lists/workflow history’ to your site URL. Please note that the space between workflow and history is not a typo. The workflow history has many important columns, which can help you in your troubleshooting saga e.g.
  1. User ID – Who started/executed the workflow.
  2. Event Type – It comes in different numeric codes and Mr. Google will be happy to decipher that for you.
  3. Description – Very important field and always contains some very relevant information about what happened.
  4. List ID – The ID of the list, document library etc where the workflow is associated with.
  5. Primary Item ID – Another important field which tells you the ID of the item in the list/document library, to which this workflow is linked with.
  6. Date Occurred – The date on which the workflow was executed.
List ID and Primary Item ID
The workflow history tables contains the information about all the workflow running in anyone of the lists/document libraries of your site. Wouldn’t you just love to know how you can see only those workflows which are linked to the list/document library that you are working on?  I know you would. Luckily SharePoint assigns a unique ID to all Lists and document library that you create. So don’t worry and follow the below steps to find the unique list ID for your list or document library.
  1. Open the site in SharePoint Designer.
  2. Then we go to the ‘Lists & Libraries’ > <list name> .
  3. Once there you can view the ‘List ID’ in the ‘List Information’ box.
So if you will filter the ‘Workflow History’ list’s ‘List ID’ column with the list id of the list you want to search you will get all the entries of the list/document library that is central to your investigation or troubleshooting.

Luckily for you, SharePoint also assigns a unique Item ID to each item in the list. It is not displayed in the default views, but playing with the view settings, you can easily add the list id to be available for view. I am not going to provide you details on how to do that, because if you are working on troubleshooting workflows, you would be an expert in the doing the above two. But what you would need to know is that the Primary Item ID in the ‘Workflow History’ table, links with the Item ID in your list. So you can find out more details about which list item is causing your workflow to break.

Workflow Settings & Details
You might need to list all the workflows running on one item in your list. It is as easy as ABC. Just open the item from the list and click on the ‘Workflows’ button in the top most ribbon. Clicking on any workflow will even allow you to get more information and details about the workflow while also allowing you to terminate the workflow if required.
Well thats all from the newsroom till Khabarnama at 9!



1 comment:

Manish said...

Thanks For sharing the information. I have a question, In my case primary Item ID and ListID are blank. so how would i link with list to workflow History List?