This project is read-only.

Workflow invoke another?

Jun 20, 2008 at 11:35 PM
Edited Jun 21, 2008 at 3:48 AM
First off, this is awesome. Much easier on the eyes than Workflow Foundation, and to top it off you can use dependency injection, and write unit tests! Great work!

I have two questions. Is it currently possible for one workflow to start another? I have kind of assumed that I will create a task that starts a workflow. Right approach?

Second question. I noticed that some of the example triggers are declared with a type. Does this mean firing the trigger you pass in an instance of the type? To help illustrate what I'm trying to do I've included the probably mangled, but hopefully understandable workflow.

workflow @EmployeeWorkflow

trigger @LoggedIn
trigger @ClosedApplication
trigger @OpenedCustomerRecord is Person
trigger @LoggedOut
trigger @ClosedCustomerRecord

state @AwaitingLogin:
    @LoggedIn                    >> @AwaitingEmployeeAction
    @ClosedApplication            >> @Closed

state @AwaitingEmployeeAction:
    @OpenedCustomerRecord        >> @OpenRecord
    @Loggged                    >> @AwaitingLogin

state @OpenRecord:
    @ClosedCustomerRecord        >> @AwaitingEmployeeAction

    //Is this right were there a task for starting a workflow to use persons record for context
    //of new workflow?
    on_enter_state @StartWorkflow, "CustomerWorkflow", @OpenedCustomerRecord

state @Closed
Jun 22, 2008 at 4:11 PM
After trying things out. I realize that "is Person" expects a type, not an instance of Person. I wonder if what I was trying is over complicating things. I'd be interested to hear other opinions.
Coordinator
Jun 22, 2008 at 5:21 PM


katokay wrote:
After trying things out. I realize that "is Person" expects a type, not an instance of Person. I wonder if what I was trying is over complicating things. I'd be interested to hear other opinions.


I think your approach is correct, launching a child workflow using a task. If you create a custom task to launch a child workflow, you can probably get to an instance of the person you need through the context that is passed into the task. One user has a blog entry on launching a child workflow from a parent state here: http://codebetter.com/blogs/kyle.baley/archive/2008/06/02/simplestatemachine-on-codeplex.aspx. Let me know if that helps.
Jun 23, 2008 at 1:01 AM
Wow, I read that post and skimmed right over the custom tasks. Thanks for the reply. I think something similar to what you've described will work.