Archive: SharePoint Designer 2010 Workflows – an alternate deployment option
This article was originally written in April 2012. It is being reposted here as an archive.
I love SharePoint Designer and all the cool things you can do with it as a no-code solutions expert. I love the concept of being able to save a globally reusable workflow as a Site Template and deploying it to other site collections via Visual Studio or Sandbox Solutions. Unfortunately, we ran into some major issues when trying to deploy a .wsp file from a local machine to our development server to the client’s stage server and finally to production.
I worked with one of our developers to try and deploy workflows through Visual Studio. Unfortunately, for a variety of reasons, we couldn’t get it to work. You can read his take on our deployment adventure in his 3-part blog here: Importing SharePoint Designer Workflows into Visual Studio – Part 1, Part 2 & Part 3.
After spending way too much time on that process, we decided we were going to use the process that Microsoft gave us; Save as a Template, upload into User Solutions, Activate and then turn on the feature. In theory, this sounds great. Unfortunately, we ran into a bunch of issues with this process too…including variables getting messed up, empty folders being created, changes not updating, buttons not working, InfoPath form customizations getting lost, etc. We would resolve one issue and the next time, a totally new one would pop up. The worst thing of all was that when we deactivated the feature and removed the solution, our out-of-the-box task fields that the workflow used were removed too!
As a last resort, I decided to try the same thing that I did when I needed to get a workflow in SharePoint 2007 from one site to another: Copy and Paste. Yup, that’s right, I just copied and pasted a workflow from one site to another, did a quick “Find and replace” of GUID’s for list ID’s and I was able to use the same workflow on multiple sites, my own 2007 version of a reusable workflow.
I thought it was my own little secret way until I just searched for and found this post by Paul Galvin that gives great step-by-step instructions for moving 2007 workflows: https://www.nothingbutsharepoint.com/sites/eusp/Pages/why-can_e2_80_99t-i-easily-port-sharepoint-designer-workflow-solutions-from-one-list-to-another-part-2.aspx). The only thing missing is that you will need to do a Find and Replace of the GUID’s once you have the workflow in its new home. I have only used this method for copying workflows from one site to another in the same site collection in the same environment. I do not know if it will work from environment to environment.
Here are the updated instructions for SharePoint 2010.
Some notes about these instructions:
- Workflows were created as Reusable workflows and were not associated with any lists or content types.
- I created these workflows on a subsite so they could be tested, then copied it up to the parent site where I could then globally publish them on our development environment and then followed the same process on our production environment.
- Our site columns and content types were created through Visual Studio so that all of our environments have the same GUID’s. If you are not able to have a developer do this, then you may need to do a few extra steps listed at the end to re-align everything.
- These workflows do not include any lookups to other site lists, but they do include global site columns.
Here is the process that worked best for us. These steps assume that you have completed your workflow, it is fully tested and you are ready to move it to its new home.
First we need to make sure that the workflow’s new home has a “Workflow” folder for it to be moved to.
- In the site where you will be moving your workflow, go to All Files (see print screen below if you get a blank screen) and confirm that there is a “Workflows” folder.
- If there is not, create a new reusable workflow. Don’t worry about adding in steps or publishing it…we are just doing this to create the folder.
The following steps happen on the site where the workflow that you want to move currently exists.
- Click on “All Files”
- Click on the “Workflows” folder
- Click on the name of the workflow that you want to move, right click and select “Copy” (or select and click Ctrl +C)
- Go to the workflow’s new home, “Workflows” folder
- Paste your folder in the “Workflows” folder by either clicking “Ctrl+V” or right click and select “Paste”
- Now click on Workflows link in the left navigation and open your workflow.
- If your form has any out of the box Association or Task InfoPath forms, delete them and let the new site re-generate them for you.
NOTE: If you customized the Initiation and/or Task InfoPath form, click on them to open InfoPath and publish them. SharePoint will do some back-end magic that will associate your form with this workflow on this site.
NOTE: Your Task form may have a different name with “Copy” if you are using the out of the box task form. If you need to associate a custom content type task form to your workflow, check out this article: Assign a Custom Content Type to Task Process in a SharePoint Designer 2010 workflow
- Click through all the steps in your workflow or click on Check for errors to confirm that everything is aligned correctly.
o This is where you may need to delete remove associated fields and re-add them. Or delete fields that you are populating and re-add them in the new environment.
- Since all of our fields and content types were created with code and the GUID’s matched, I don’t have any examples to show.
- If you need to make your site globally available, paste your workflow in the “Workflows” folder on the parent site and you can click on “Publish Globally” from here.
Notes about globally publishing a workflow:
- I don’t recommend copying and pasting directly into the global workflows folder. In theory I think it would work, but I don’t know enough about what SharePoint magic happens to make a workflow globally available, and I’d rather be safe than sorry.
- If you have a globally published workflow that you need to add to a content type, don’t add it during business hours or during times where users may actively be editing that content type…they may lose their information as your changes override theirs.
o The same goes for re-publishing changes to the global workflow.
- If you have custom InfoPath forms, the process of globally publishing it will generate a new out of the box form. To replace this, copy the forms from your “All Files ->Workflows” folder and paste into the Global Workflows folder: “All Files ->_catalogs ->wfpub”