Roles and next activities help needed?

Hi

Let’s say I have 2 custom activities, VerifyIDActivity and VerifyOccupationActivity. They both have a ListenActivity with two HandleExternalEventActivities (eg OccupationVerified and OccupationUnverified) . I want the user user to select one or the other.

Now I add my activities to a sequential workflow that workflows a new customer. I am using SqlWorkflowPersistenceService and the SqlTrackingService in my workflow runtime. I know that I can use the instance.GetWorkflowQueueData() to see which activity is blocking and then enable or disable buttons on the screen. The problem is that I that the user needs to open the customer first to see that it is waiting for a OccupationVerified or OccupationUnverified event.

This is what I would like?

1. I would like to assign roles to my custom activities to specify who is allowed to do VerifyIDActivity or VerifyOccupationActivity.

2. I would like to have a list of all customers on the screen where the users that are allowed to do ID verification only see the customers that need ID verification.

I have used the TrackingDatabase to show me the activities that are still running. But it gives me other activities like the parallel activity and the listen activity and I don’t know how to get the roles that are assigned to an activity.

Thanks

Gert

[2504 byte] By [GertB] at [2007-12-23]
# 1

Hi

This is what I have done.

In my custom activities I have added a property Roles witch is a string and then in the Execute I call TrackData to save the value if Roles to the tracking database.

private string roles;

public string Roles

{

get { return roles; }

set { roles = value; }

}

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)

{

this.TrackData("Roles", roles);

return base.Execute(executionContext);

}

Then I have created a view that gives me all Executing activities with there UserEvent data, which I can use to do my Roles checking against. This is my work list.

CREATE view [dbo].[View_LastActivities] as

SELECT [ai].[QualifiedName]

, case WHEN CHARINDEX('.', [ai].[QualifiedName]) = 0 then [ai].[QualifiedName]

else SUBSTRING([ai].[QualifiedName], 0, CHARINDEX('.', [ai].[QualifiedName]))

end as [Name]

,[ase].[ExecutionStatusId]

,'ExecutionStatus' = (select Description from WorkflowTracking.dbo.vw_ActivityExecutionStatus where ExecutionStatusId = ase.ExecutionStatusId)

,[ase].[EventDateTime]

,[ai].[ContextGuid]

,[ai].[ParentContextGuid]

,[ase].[EventOrder]

,'TypeFullName' =

CASE

WHEN [t1].[TypeFullName] IS NULL THEN [t2].[TypeFullName]

ELSE [t1].[TypeFullName]

END

,'AssemblyFullName' =

CASE

WHEN [t1].[AssemblyFullName] IS NULL THEN [t2].[AssemblyFullName]

ELSE [t1].[AssemblyFullName]

END

,[ase].[ActivityExecutionStatusEventId]

,[ase].[DbEventDateTime]

,[aed].[UserDataKey]-- This is the Roles

,[aed].[UserData_Str]--

FROMWorkflowTracking.dbo.vw_ActivityExecutionStatusEvent [ase]

INNER JOINWorkflowTracking.dbo.vw_ActivityInstance [ai]

ON[ase].[ActivityInstanceId] = [ai].[ActivityInstanceId]

INNER JOINWorkflowTracking.dbo.vw_WorkflowInstance [wi]

ON[ai].[WorkflowInstanceInternalId] = [wi].[WorkflowInstanceInternalId]

LEFT OUTER JOINWorkflowTracking.dbo.vw_Activity Angel

ON[wi].[WorkflowTypeId] = Angel.[WorkflowTypeId]

AND[ai].[QualifiedName] = Angel.[QualifiedName]

LEFT OUTER JOINWorkflowTracking.dbo.vw_Type [t1]

ONAngel.[ActivityTypeId] = [t1].[TypeId]

LEFT OUTER JOINWorkflowTracking.dbo.vw_AddedActivity [aa]

ON[aa].[WorkflowInstanceEventId] = [ai].[WorkflowInstanceEventId]

AND[ai].[QualifiedName] = [aa].[QualifiedName]

LEFT OUTER JOINWorkflowTracking.dbo.vw_Type [t2]

ON[aa].[ActivityTypeId] = [t2].[TypeId]

LEFT OUTER JOINWorkflowTracking.dbo.UserEvent [aed]

ON[aed].[ActivityInstanceId] = [ase].[ActivityInstanceId]

AND[aed].[UserDataKey] = 'Roles'

WHERE[ase].[ExecutionStatusId] = 1

and ase.ActivityExecutionStatusEventId in (

select max(asee.ActivityExecutionStatusEventId) ActivityExecutionStatusEventId

from WorkflowTracking.dbo.vw_ActivityExecutionStatusEvent asee

INNER JOIN WorkflowTracking.dbo.vw_ActivityInstance aii

ON asee.ActivityInstanceId = aii.ActivityInstanceId

where [asee].[WorkflowInstanceInternalId] = [ase].[WorkflowInstanceInternalId]

Group by aii.WorkflowInstanceInternalId, aii.QualifiedName

)

If there is a better solution I would appreciate it.

Thanks

Gert

GertB at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified