index > Windows Workflow Foundation > Changing the workflow's controls properties at runtime

Changing the workflow's controls properties at runtime

Hello,

I'll explain my situation: I have a document validation workflow, where 3 different ranks of users can post documents and their superior rank has to validate them. I use an sql role provider with the 3 roles defined. When a user wants to submit a document he has to fire an event ("start workflow"). My idea is that after receiving that event I would like to insert a code activity where I check the username of the person that fired the event and check wich is his role. And then based on that role, I would change the "Roles" property of the other event handlers to set it to the role of the superior that has to validate.

So for example, a person with the role "Technician" submits a document. Then after he fires the first event I see what his role is and change the other eventhandlers "Roles" property so that only his superior ("ProjectManager") can fire those events. That is the idea, and I don't see why this can't be done, but the problem is that I don't know how to change the property in runtime and not in design time, from the code beside file I cant find the eventhandler objects and get to their properties. Is it possible to do that? Or someone has some suggestion on another way to achieve the same result?

Thank you very much,

Rubén

Samoyed

Ruben

  1. Define a variable in your workflow defintion of type WorkflowRoleCollection.
  2. Set the Roles property on the EventHandler to the variable in step #1.
  3. In your code activity, create a new WebWorkflowRole with the correct role name, then add this role into the collection created in #1.

In short, don't change the property, just change the items in the collection.

See the SDK sample under technologies/Roles/WebWorkflowRole to see an implementaiton of this.

Matt




See What You Can Learn -- http://www.pluralsight.com/courses/IntroducingWF.aspx
Matt Milner - Pluralsight

Thank you very much, Matt! I'll try it out as soon as I have my computer back :-)

Samoyed
reply 3

You can use google to search for other answers

 

More Articles

• Why did GetService() Changed the way it worked from Beta 2.0 to 2...
• If the session lost , how to make the long-running workflow going...
• Threading question again.
• How to create Wizard using Workflow?
• wf.Parameters
• Rule editor problem
• Usage of WWF in a .NET 2.0 app?
• Beta2: String-Properties in Custom Activities; Custom themes
• Rules Editor Not Loading With Beta 2.2 (XOML only State Workflow)
• Problems migrating a TrackingService implementation from Beta1 to...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Custom Activities don't appear in the to
• Error: EventDeliveryFailedException ?
• does any of the labs work without a prob
• Files saved to a CD unable to open
• Workflows for Express
• Sheduling API Feature Request
• Access Workflowruntime
• How To Get Event Args To The Host While
• support of login-based rss-feeds?
• Persistance does not kick-off automatica
• sequential WorkFlow
• How is WWF Store Persitant Workflow Info
• workflow standards
• Another question about state machine and
• StateMachine- or SequentialWorkflow?

Hot Articles

• accessing child activity parameters on P
• How to communicate between Parent childs
• Transaction Requires a Persistence Servi
• How to load conditions from a .rules fil
• How to use ValidationOption
• how to change the time to Beijing time i
• WWF for the absolute beginner?
• Bug? Removing UI type editors on paramet
• Firing a custom event in a workflow
• Modifyable code in Custom Activity
• Workflow Designer Flexibility
• duplicate ruleconditionsattribute
• multiple inouts to an activity
• How can I get Workflow Status from Track
• Raising Events or Public Properties?? wh

Recommend Articles

• Determine correct activity instance duri
• dynamically creating workflows
• ASP.NET Workflow Requirement
• SQLPersitence question
• Tracking query does not return any workf
• HELP!! Tracking Service is not working
• No Editor Available For "file ..&qu
• Trouble with WF HOL Lab 3
• Getting workflow information before the
• Any plan to support C++ or Managed CLI/C
• How can a replicator be used in a XOML o
• Looking for WF Application Deployment Su
• How to get Workflowinstance from a State
• Custom Workflow
• Web Service credentials