Workflow History List中的字段含义

If you are reading this post you probably know about hidden lists in SharePoint sites. Well, one of the hidden lists by default is the "Workflow History" list. The greatest SharePoint workflow history flaws (in my opinion) is that they do not audit. This issue has been well documented. The workflow history is cleaned out after 60 days. At this point you loose all workflow history and the workflow task created. What you might not know is that the workflow history is actually stored in a list, where you can extract to Excel and pivot on the information extracted.

 Even though it is hidden it does not mean you can't navigate to it. Enter Url : http://servername/Sitename/Lists/Workflow History   and you will go to the actual List.

 The disadvantage of this list is that it is not user friendly. It has Guids and Id's that are really not very useful. The point of this blog is not to tell you how to make it user friendly but to give clarify some of the information in this list that can give you some ideas on how to manuplate this data and get what you want out of it.

  The following is a picture of the columns I will out line:

                                                   

So, what are these columns exactly?

        Workflow History Parent Instance - This is the ID tof the actual instance of the workflow. Lets say you have a document and you start a workflow on it, well, it will assign an instance ID to that workflow. If you start the same workflow on another document, in the same document library, it will use the same workflow but it needs a way to differentiate this instance of the workflow from the one already started. So you'll get a new instance ID. Notice you cannot apply the same workflow more than once if the workflow is not completed. Once the workflow is complete you can start the same workflow again, but it will be assigned a new Instance ID.即当前生成的Workflow的Instance.       

          Workflow Association ID - after a workflow is made availlable to a document library, it is called an association. You can name the workflow and make it availlable to each item in the document library. There is an ID assigned to this association. This means that if you have an Approval workflow, and you make an association to a document library, it will have a different association ID if you make it availlable to another document library, although it might have the same Template ID.即被附加进List后生成的模板

        Workflow Template ID - This is the guid that was assigned to the workflow.xml. If you created a custom workflow navigate to your feature folder and take a look at your workflow.xml to varify.即site中该Workflow

        List ID - This is the list Id where the list item that has the workflow attached to it. In other words the workflow was innitiatiated on an item in this document library.被附加的List

        Primary Item ID - if you notice, each list item has been assigned an index value. In the above picture, it just so happens that this was the first item or document I added to this doc library.被启动的item

 

 

If you want to get to the information, for example, let's say you want the name of the Association Workflow, or you want to get to the task created for a workflow, use the SPWorkflowManager object.

       this is accessed through the site collection .

            SPSite siteCollection = new SPSite("http://localhost");
            SPWorkflowManager manager = siteCollection.WorkflowManager;

 

You can now go ahead and access:

              manager.GetItemActiveWorkflows
              manager.GetItemTasks
              manager.GetItemWorkflows
              manager.CountWorkflowAssociations

 

The above methods take parameters but you have all the parameter information availlable to you through the Guids and ID's explained above.

 转自http://www.imaginets.com/cs/blogs/juanl/archive/2008/08/21/workflow-history-decoding-guids-and-how-to-use-them.aspx

posted @ 2009-03-11 10:47  邑尘  阅读(1068)  评论(0编辑  收藏  举报