Use workflow interop for SharePoint 2013
Provides a discussion of using SharePoint workflow Interop in the Visual Studio 2012 workflow designer. Workflow interop allows you to invoke a SharePoint 2010 workflow from within a SharePoint 2013 workflow. This is an important feature that allows you to reuse existing workflow features, and to call on workflow activities that are not integrated into SharePoint 2013.
Last modified: September 17, 2015
To learn about using SharePoint workflow interop functionality in SharePoint Designer 2013, see Understanding Coordination actions in SharePoint Designer 2013.
Here's the problem. You have legacy SharePoint 2010 workflows that you wish to reuse on your SharePoint 2013 platform. Or, worse, you are creating new SharePoint 2013 workflows and you need to invoke activities that are only available in the SharePoint 2010 platform. And you don't know what to do. Actually, the solution is simple: use SharePoint workflow Interop.
SharePoint workflow interop enables SharePoint 2010 workflows (built on Windows Workflow Foundation 3) to work smoothly with the SharePoint 2013 workflow engine, which is based on Windows Workflow Foundation 4. While the new Windows Workflow Foundation 4 execution engine is hosted in Workflow Manager, which runs as an external service, SharePoint 2013 still contains the legacy SharePoint workflow host which it uses to process SharePoint 2010 workflows. SharePoint workflow interop negotiates the two execution environments, as depicted in Figure 1.
Let's walk through the process depicted in Figure 1. Use the letters to reference points of emphasis in the illustration:
SharePoint workflow interop is a messaging framework that supports a one-to-one instance mapping between WF 3 and WF 4 workflow activities. WF 3 and WF 4 interoperate through message exchanges that are wrapped by a set of WF 4 activities on WorkflowInteropService.
To support workflow interop, the workflow design surface in SharePoint Designer provides access to a new workflow activity, Start 2010 WF, which is a wrapper on the StartWorkflow method. This activity allows you to start either a list workflow or a site workflow.
The activity is in fact a sequence of messages that take place between the Workflow Manager and the SharePoint 2010 Workflow Host that is running inside SharePoint 2013. These two are mediated by a messaging layer, as shown in Figure 4. The sequence begins in the SharePoint 2013 workflow manager with an invocation of the StartWorkflow method. The "start" message goes to the workflow service inside of SharePoint, where in turn it launches the workflow inside the SharePoint 2010 workflow host. When execution of the 2010 workflow is complete, an event is fired that sends a "completed" message through the event publisher back to the 2013 workflow manager.