How to give input parameters to workflow? And what about deactivation?

Hey guys,

I'm trying to figure out how I can initialize a workflow with parameters so that e.g. CallExternalMethodActivity can pass values to other methods. The RaiseEventToLoadWorkflow example I guess was supposed to use that kind of parameters for DocumentID and ApprovedBy but unelegantly "solves" the problem by blatantly ignoring it.

The other question is, what happens upon deactivation of an idle workflow. Will these parameters and results of other activities get de/serialized when I save and load a workflow?

Thanks, Christoph

[576 byte] By [ChristophWienands] at [2007-12-19]
# 1

Hi people!

Christoph: You can pass parameters to a workflow instance, at creation time:

Dim pars as new Dictionary(Of String, Object)

pars.Add("Name","Joe Dow")

wi = workflowRuntime.CreateWorkflow(GetType(MyGreatWorkflow),pars)

You can pass a IDictionary implementation. Then, the name of the parameters must be the name of properties in your workflow class.

Partial Class MyGreatWorkflow
Inherits SequentialWorkflowActivity

Public Property Name as String

.....

Angel "Java" Lopez

ajlopez at 2007-9-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

Hi Christoph,

You can pass parameters to a workflow as Angel describes above.

As for your question with regards to workflow state on unload/load, the answer it "yes." All of your workflow state, including the parameters, will be serialized and thus retain their value upon loading.

Thanks,

Angel

AngelAzcarraga at 2007-9-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Hi Christoph,

In Windows Workflow Foundation Beta 2 Hands-on Labs, Lab9 has a sample on initializaing workflow with parameters.

Regards,

Xin

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

Software Development for Windows Vista

Site Classified