I’m looking into querying a site’s default WorkflowHistory list to build a simple display/filtering mechanism, rather than creating a custom view and turning users loose on that. There are a lot of fields available in this list, and some of their usage wasn’t completely obvious by name. Here are a few definitions (adapted from this site, thanks ceci):
Workflow History Parent Instance – The unique ID of a given instance of a workflow, i.e. Workflow X that was started on Document Y will be assigned Workflow History Parent Instance Z (as a GUID)
Workflow Association ID – The unique ID of the relationship between a particular workflow and the list or library to which it is associated. The act of adding a site workflow to a library creates this association, presumably creating a declarative workflow in SPD against a single list creates it as well.
Workflow Template ID – The unique ID of a particular workflow that is assigned when a workflow is created, and therefore the workflow that generated the Workflow History Item
List ID – the list that the particular Workflow History Item was generated by
Primary Item ID – The ID of the item in List{List ID} that generated the Workflow History Item
For grouping and filtering purposes, the most useful values are probably:
Workflow Template ID–especially if more than one Workflow is associated with a history list
List ID–to filter entries by list, since multiple workflows at the site level will (by default, but don’t have to) write their history into the same list
Primary Item ID–to get back Workflow History items associated with a specific document or list item
In my case, I am using Primary Item ID as a runtime filtering parameter, and using a design time parameter for the List ID.
Note that it may make life simpler to create a dedicated Workflow History list for your workflow, especially if it is highly “verbose” or frequently used. Your history list can grow rapidly in size, particularly if you are doing a lot of logging from the workflow. You might consider deleting or changing your logging statements to comments to help manage list growth.
Filed under: General, SharePoint, Site Customization, Workflow Tagged: Filter, SharePoint, WorkflowHistory
