SQL Query to Get Tracking Data in Workflow Foundation 3.5

Below is a query that will return tracking data when using the SQL

Simply substitue the GUID for the WF instance that you want to find out tracking details about and then fire the query to see the tracking data.

declare  @WorkflowInstanceInternalId   bigint

select   @WorkflowInstanceInternalId = WorkflowInstanceInternalId
from dbo.WorkflowInstance
where
         WorkflowInstanceId = 'E3573C8D-96D7-47C9-AE64-CB3E197A18CE'

select   wie.EventDateTime,
         'Workflow ' + twe.Description [Status],
         wie.EventOrder,
         '' [QualifiedName],
         '' [TypeName],
         '' [UserDataKey],
         '' [UserData_str]
from dbo.WorkflowInstanceEvent wie
   inner join dbo.TrackingWorkflowEvent twe
      on (wie.TrackingWorkflowEventId = twe.TrackingWorkflowEventId)
where wie.WorkflowInstanceInternalId = @WorkflowInstanceInternalId
union
select   se.EventDateTime,
         aes.Description [Status],
         se.EventOrder,
         ai.QualifiedName,
         case when charindex('.',reverse(t.TypeFullName)) > 1
                   then right(t.TypeFullName,charindex('.',reverse(t.TypeFullName))-1)
                   else ''
            end [Type],
         '' [UserDataKey],
         '' [UserData_str]
from dbo.ActivityExecutionStatusEvent se
   inner join dbo.ActivityExecutionStatus aes
      on (se.ExecutionStatusId = aes.ExecutionStatusId)
   inner join dbo.ActivityInstance ai
      on (se.ActivityInstanceId = ai.ActivityInstanceId)
   inner join dbo.WorkflowInstance wi
      on (ai.WorkflowInstanceInternalId = wi.WorkflowInstanceInternalId)
   left join dbo.Activity a
      on (a.WorkflowTypeId = wi.WorkflowTypeId
      and ai.QualifiedName = a.QualifiedName)
   inner join dbo.Type t
      on (a.ActivityTypeId = t.TypeId)
where se.WorkflowInstanceInternalId = @WorkflowInstanceInternalId
union
select   ue.EventDateTime,
         'UserData' [Status],
         ue.EventOrder,
         ai.QualifiedName,
         '' [TypeName],
         ISNULL(ue.UserDataKey, '') [UserDataKey],
         ue.UserData_str
from dbo.vw_UserEvent ue
   inner join dbo.ActivityInstance ai
      on (ue.ActivityInstanceId = ai.ActivityInstanceId)
where ue.WorkflowInstanceInternalId = @WorkflowInstanceInternalId
order by EventOrder,
         EventDateTime

Tags: , ,

3 Responses to “SQL Query to Get Tracking Data in Workflow Foundation 3.5”

  1. KEN says:


    PillSpot.org. Canadian Health&Care.Best quality drugs.No prescription online pharmacy.Special Internet Prices. No prescription drugs. Order pills online

    Buy:Female Pink Viagra.Zetia.Amoxicillin.Seroquel.Aricept.Advair.Cozaar.Prozac.Lipothin.Zocor.Benicar.Wellbutrin SR.Lipitor.Female Cialis.Nymphomax.Ventolin.Lasix.Acomplia.Buspar.SleepWell….

  2. DWAYNE says:


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

Leave a Reply