Export modified default Workflow to .wsp

Today I wanted to use a SharePoint 2010 based workflow in SharePoint 2013. I choose for a default workflow, and modified the workflow in a few different areas, such as the default emails that were being sent out. That Approval Workflow is great, except for the dodgy emails you get right?

Since I work in a team, it was important that the rest of my team members were also able to install the same workflow, without having to edit it themselves. So I needed a way of exporting the workflow to Visual Studio. What surprised me was that the ‘Save as template’ option was greyed out. 

Workflow_1As the documentation at http://msdn.microsoft.com/en-us/library/jj819316.aspx describes, you can only save a SharePoint 2010 based workflow as a template if this is a Reusable Workflow. However, the default workflows provided with a SharePoint 2013 Publishing site are all globally reusable workflows. Thus, the export button is greyed out.

Resolving this issue is actually very straight forward. If you click on the ‘Copy and Modify’ button:

Workflow_2

You will be prompted for a few different options. For the ‘Choose a base contenttype’ option, make sure you select ‘All’, otherwise chances are you will not get the option to use this workflow for creating major versions of a page (in case you are modifying the approval workflow). Give the workflow a name and description and click OK. The newly created workflow will be a reusable workflow, and not a globally reusable workflow. This means the ‘Save as template’ option is no longer greyed out, and you can continue on exporting the workflow as .wsp which you can then import into Visual Studio for all your team members to enjoy. Gotcha!Workflow_3