Anyone that has worked with SharePoint 2010 workflows knows what a valuable tool they can be for a variety of tasks. However, list workflows in particular suffer from a reusability problem. While site and reusable workflows are by design (and definition) reusable, list workflows are tied to a specific list. That does not mean that there are cases when copying or moving the workflow to a different site is a desired action.
I recently ran into an issue when I wanted to copy a list from one site to another along with all of the associated content and workflows. I quickly found out that while it was relatively simple to move the list and data (with a few gotchas concerning lookup columns), the workflows I had on the list were not so easy to move. Of course I could have recreated the workflow steps in SharePoint Designer on the copied list, but the number of steps I had in the workflow drove me to seek an alternative method. Here are the steps I eventually took in order to move the workflow to the copied list on a different site:
1. Select the workflow on the original list (henceforth the 'old workflow') and select "Export to Visio"
2. Create a new, blank (this is important) workflow on the copied list. The name you give it does not matter at this point. This will be the 'new workflow'.
3. Save and Publish the new workflow to the copied list.
4. Select the new workflow and "Export to Visio"
5. You should now have two *.vwi files, one for each workflow. This is where things start to get a little trickier: Change the file extension of both files to .zip
6. Surprisingly (if you have never used this trick before) you will be able to open the zip files like any other archive and edit the files inside. Unzip and open both of the newly created archives.
7. Copy the *.xoml and *.xoml.rules files from the old workflow to the new workflow.
8. Zip up the new workflow's folder and change the file extension to .vwi.
9. On the new site, use the "Import from Visio" option to create the new workflow. At this point, all the steps will have been copied over to the new site but the workflow will not function correctly if there are references to site-specific entities.
10. Edit the new workflow in SPD and look for any references that have a GUID instead of the name of the item; this indicates that it must be updated to point to the item on the new site as it was looking for the item (by GUID) that existed on the old site.
11. Publish and test the new workflow.
That is all that needs to be done to move a workflow to a different site. Using this algorithm saved me a lot of time that I would have spent recreating each step in a workflow when I only wanted to move it to another place.
Learn more about DMC's SharePoint Workflow services.