In the SQL stored procedure, dbo.GetInvokedWorkflows, the data set returns a value for WorkflowStatus that does not match with the TrackingWorkflowEvent enumeration. By looking at the dbo.GetWorkflows stored procedure which does work correctly, it appears as if some made a typo.*****************************************************************--FROM dbo.GetInvokedWorkflows--***************************************************************** SELECT 'CurrentEventTimeStamp' = GetUTCDate() ,[wi].[WorkflowInstanceId] ,[wi].[WorkflowInstanceInternalId] ,[wi].[InitializedDateTime] ,[wi].[CallerInstanceId] ,'WorkflowStatus' = CASE WHEN [wie].[TrackingWorkflowEventId] = 2 THEN cast(1 as int) /* Completed */ WHEN [wie].[TrackingWorkflowEventId] = 4 THEN cast(2 as int) /* Suspended */ WHEN [wie].[TrackingWorkflowEventId] = 10 THEN cast(3 as int) /* Terminated */ ELSE cast(0 as int) /* Running */ END ,[t].[TypeFullName] ,[t].[AssemblyFullName] FROM [vw_WorkflowInstance] [wi] INNER JOIN [dbo].[vw_Type] [t] ON [wi].[WorkflowTypeId] = [t].[TypeId] LEFT OUTER JOIN [dbo].[vw_WorkflowInstanceEvent] [wie] ON [wi].[WorkflowInstanceInternalId] = [wie].[WorkflowInstanceInternalId] WHERE ( [wie].[EventOrder] = ( SELECT max([EventOrder]) FROM [dbo].[vw_WorkflowInstanceEvent] [wie2] WHERE [wie2].[WorkflowInstanceInternalId] = [wie].[WorkflowInstanceInternalId] AND [wie2].[TrackingWorkflowEventId] != 6 ) OR [wie].[EventOrder] IS NULL ) -- Profile might not track instance events AND [wi].[CallerInstanceId] = @WorkflowInstanceId AND [wi].[InitializedDateTime] > @BeginDateTime AND [wi].[InitializedDateTime] <= @EndDateTime*****************************************************************--FROM dbo.GetWorkflows--***************************************************************** SELECT ''CurrentEventTimeStamp'' = GetUTCDate() ,[wi].[WorkflowInstanceId] ,[wi].[WorkflowInstanceInternalId] ,[wi].[InitializedDateTime] ,[wi].[CallerInstanceId] ,''WorkflowStatus'' = CASE WHEN [wie].[TrackingWorkflowEventId] IS NULL THEN cast(4 as int) /* No events tracked - all we know is that it was created */ WHEN [wie].[TrackingWorkflowEventId] = 0 THEN cast(4 as int) /* Created */ WHEN [wie].[TrackingWorkflowEventId] = 1 THEN cast(1 as int) /* Completed */ WHEN [wie].[TrackingWorkflowEventId] = 3 THEN cast(2 as int) /* Suspended */ WHEN [wie].[TrackingWorkflowEventId] = 9 THEN cast(3 as int) /* Terminated */ ELSE cast(0 as int) /* Running */ END ,CASE WHEN [t].[IsInstanceType] = 0 THEN [t].[TypeFullName] ELSE NULL END ,CASE WHEN [t].[IsInstanceType] = 0 THEN [t].[AssemblyFullName] ELSE NULL END FROM [vw_WorkflowInstance] [wi] INNER JOIN [dbo].[vw_Type] [t] ON [wi].[WorkflowTypeId] = [t].[TypeId] LEFT OUTER JOIN [dbo].[vw_WorkflowInstanceEvent] [wie] ON [wi].[WorkflowInstanceInternalId] = [wie].[WorkflowInstanceInternalId] WHERE ( [wie].[WorkflowInstanceEventId] = ( SELECT max([WorkflowInstanceEventId]) FROM [dbo].[vw_WorkflowInstanceEvent] [wie2] WHERE [wie2].[WorkflowInstanceInternalId] = [wie].[WorkflowInstanceInternalId] AND [wie2].[TrackingWorkflowEventId] NOT IN ( 5, 6, 7 ) -- Persisted, Unloaded, Loaded ) OR [wie].[EventOrder] IS NULL ) -- Profile might not track instance events '
Product Version