Sub Flows within XOML based workflows

Hi,

I have a workflow which is XOML based and the XOML and rules file is loaded dynamically from the DB.

With this I have a server control which manages all workflows loaded into with forward and back controls.

I want to implement sub flows now and am wondering how to go about this with XOML based workflows. I have a demo working with code based files but cannot get the XOML working?

Is it possible? if so, any pointers would be greatly appreciated.

Thanks!

[497 byte] By [M_Laz] at [2007-12-23]
# 1

Start with Jon's custom invoke workflow activity sample found here. Just update the StartWorkflow method in CallWorkflowService to take the xoml and / or rule path.

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

Hi Tom,

Thanks for that.This demo works fine intially, but as soon as the CalledWorkflowLibrary.dll is recompiled (without making any changes) I get an error saying "Unable to start program <PATH> Called WorkflowLibrary.dll.

Is this a version issue, I am on the latest version (well I upgraded on Thurs last week)

Cheers

M_Laz at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
if you run it from VStudio, set "HideChildWorkflow" project as the startup projet, before starting the application.
SergeLuca at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Thanks alot!
M_Laz at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

Tom,

I didnt get you answer clearly. Can you please explain detailly?

-Chakri

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

First change the StartWokflow method in CallWorkflowService to the following:

public void StartWorkflow(string xomlFilePath, string ruleFilePath, Dictionary<string,object> inparms, Guid caller, IComparable qn)

{

WorkflowRuntime wr = this.Runtime;

//Override the activity's Initialize method and throw InvalidArgumentException

//if the xoml file path does not exist.

XmlReader workflowDefinitionReader = XmlReader.Create(xomlFilePath);

XmlReader rulesReader = null;

if (File.Exists(ruleFilePath))

rulesReader = XmlReader.Create(ruleFilePath);

WorkflowInstance wi = wr.CreateWorkflow(workflowDefinitionReader, rulesReader, inparms);

wi.Start();

...

}

Next, remove the Type property from CallWorkflowActivity and add two string properties of type string like the below:

public static DependencyProperty WorkflowDefinitionPathProperty = System.Workflow.ComponentModel.DependencyProperty.Register("WorkflowDefinitionPath", typeof(string), typeof(CallWorkflowActivity));

[Description("This is the description which appears in the Property Browser")]

[Category("This is the category which will be displayed in the Property Browser")]

[Browsable(true)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

public string WorkflowDefinitionPath

{

get

{

return ((string)(base.GetValue(CallWorkflowActivity.WorkflowDefinitionPathProperty)));

}

set

{

base.SetValue(CallWorkflowActivity.WorkflowDefinitionPathProperty, value);

}

}

public static DependencyProperty RulesPathProperty = System.Workflow.ComponentModel.DependencyProperty.Register("RulesPath", typeof(string), typeof(CallWorkflowActivity));

[Description("This is the description which appears in the Property Browser")]

[Category("This is the category which will be displayed in the Property Browser")]

[Browsable(true)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

public string RulesPath

{

get

{

return ((string)(base.GetValue(CallWorkflowActivity.RulesPathProperty)));

}

set

{

base.SetValue(CallWorkflowActivity.RulesPathProperty, value);

}

}

Finally change the call to StartWorkflow in CallWorkflowActivity.Execute to:

ws.StartWorkflow(WorkflowDefinitionPath, RulesPath, inparams, this.WorkflowInstanceId, qn);

There is some other work you will need to do related to parameters but this should get you going and if you just comment out the code for working with the workflow properties you should be able to get this running.

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

Software Development for Windows Vista

Site Classified