Search
Resolved
as External Help for as External

1
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Bug
ID: 495013
Opened: 10/1/2009 7:06:57 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
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 '
Details (expand)

Product Version

.NET Framework 3.5 SP1
Product Language
English

Operating System
Windows XP
Operating System Language
English

Architecture
x86

Priority
(1=blocking, 2=important, 3=nice to have)
2

Severity
(1=major functionality issue, 2=important functionality issue, 3=nice to have)
2

Steps to Reproduce
Create a workflow, and intantiate child workflows from parent.
Instantiate a new SqlTrackingQuery
In one of the SqlTrackingWorkflowInstance, check the InvokedWorkflows.Status, and the WorkflowStatus enumeration does not match the return coming from the stored procedure.
Actual Results
Idle = 1,
Resumed = 2,
Aborted = 3,
All Others = 0
Expected Results
Running = 0,
Completed = 1,
Suspended = 2,
Terminated = 3,
Created = 4
Component Usage
(any information on your scenario that may help in investigating your issue)
 

How often does this happen?
Always Happens

Have you seen this problem in other versions?
No, this is new to the most recent version

File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 10/5/2009 at 11:53 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com/)
Posted by Microsoft on 10/19/2009 at 6:48 PM
This is a product issue. The fix is to update the GetInvokedWorkflows stored procedure to use the correct values for the states Completed, Suspended and Terminated.
SELECT 'CurrentEventTimeStamp' = GetUTCDate()
,[wi].[WorkflowInstanceId]
,[wi].[WorkflowInstanceInternalId]
,[wi].[InitializedDateTime]
,[wi].[CallerInstanceId]
,'WorkflowStatus' =
CASE
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


I will file a product bug to address this in the next release. Please contact product support if you need a QFE for this issue.