Using the InvokeWorkflowActivity Activity
Use the InvokeWorkflowActivity activity to start one workflow from another. The InvokeWorkflowActivity activity finishes before the launched workflow starts executing and the next activity in the workflow branch is executed. If the workflow that is to be invoked has input parameters, they will be available through the property browser for the InvokeWorkflowActivity activity.
Windows Workflow Foundation does not support recursive workflows. If Workflow A starts Workflow B, Workflow B cannot start Workflow A directly, nor can it start any workflow that directly or indirectly invokes Workflow A.
The InvokeWorkflowActivity activity asks the workflow runtime to create a new workflow using the current scheduler service attached to the runtime. The invoked workflow will only be able to receive input parameters. Getting output parameters is not supported after the workflow completes, because the activity invokes the workflow asynchronously. Standard communication rules between the workflows apply for communicating with the new workflow instance created by the InvokeWorkflowActivity activity.
An InvokeWorkflowActivity cannot be contained in a TransactionScopeActivity or a CompensatableTransactionScopeActivity. This is because a transaction cannot flow from one workflow to another. If an attempt is made to contain an InvokeWorkflowActivity inside a TransactionScopeActivity or a CompensatableTransactionScopeActivity, a validation error occurs that contains the following message:
Activity 'invokeWorkflowActivity1' validation failed: InvokeWorkflowActivity cannot be used inside TransactionScopeActivity.
For more information, see InvokeWorkflowActivity in the System.Workflow.Activities namespace in the Windows Workflow Foundation Class Library reference.