Wednesday, December 17, 2008

Understanding Workflow Tracking Service - Part 1

Hi All,

I have been working with workflows for many months and I love to explore each and every thing with respect to workflow. I learn about different activities and different ways to create the workflows and much more other stuff that can be done in workflow. One of the good stuff to do with workflow is services. Services can be attached to the workflow runtime.

Every workflow has instance and there is always a workflow runtime which handles this workflow. There are many services available that can be attached to the workflow runtime.

Here is a list of services that can be added to the workflow runtime.

(1) Workflow Persistence service
(2) Workflow Queuing service
(3) Workflow runtime service
(4) Workflow scheduler service
(5) Workflow Tracking service
(6) Workflow Transaction service

Here we are going to go with Workflow Tracking service. In this article we are going to cover the understanding on tracking service of workflow.

Read Understanding Workflow Tracking Service - Part 2
for further reading.

Workflow has one primary service which is SqlTrackingService. There are two additional services are also available which are ConsoleTracking as well as SimpleFileTrackingService. But we are going to discuss SqlTrackingService.

First let me give you a highlight on this tracking. When your workflow gets started, an instance of it gets created and starts running. This instance then fires several events internally when activities get executed. If you want to capture all these details, you can do it with the help of tracking service. You can track other things also like your own custom tracking. Let’s say at the end of every activity or in between any activity you would like to make a cross mark saying that this and this part of activities have completed executing. Something like this is possible with the tracking service.

If you want to track your custom data, you will have to prepare Tracking profile which is nothing but an XML which shows that what data to capture and what not to capture.

So Bottom line is to track the actions taking place in workflow and actions that you want to track on your own can be achieved easily through tracking service. All you need to have is SqlServer and Tracking service to attach to workflow runtime.

All this information is stored in database. So once we have data in database, then it becomes easy to have query on them and to generate reports from them.

One big advantage of querying this tracking data is WF also comes with SQLTrackingQuery class built in with it. So just play with an object of this class and have some fun getting the answers of your query. So even no need to write specific SELECT Commands for this.

Built in tracking is actually divided in three parts.

(1) Activity tracking

Activity tracking allows you to track activity related events like activity cancellation, activity execution, and unhandled exceptions in activity etc. ActivityTrackingpoint and ActivityTrackingLocation object allows you to track all these.

(2) Workflow Tracking

Workflow Tracking allows you to track workflow related events like workflow starting, workflow stopping and workflow terminated etc.

(3) User Tracking

User related all custom tracking that you would like to capture. Because user tracking is workflow to workflow specific.

If you closely look at this concept, this is very similar to tracing in ASP.NET where you have different severity levels and based on that what all information you want to capture can be traced at any point of time.

To really analyze data captured by service, WF also comes with the Tool called WorkflowMonitor. This is useful to see the execution of workflow as GUI. Where you come to know what all activities are done for specific instance and what all activities are pending to execute.

We will have a real fun in executing this service and then analyze the data captured by tracking service and using the Workflow Monitoring tool.

I will continue this article and in part 2 we will explore the tracking service practically.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to