4/13/2012 11:00 AM by Kim Frehe @chomp1313
Editor's note: Contributor Kim Frehe is a SharePoint Solution Specialist at Rightpoint Consulting. Follow her @KimFrehe
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 a supremely talented developer 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.
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.
- 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.
- Click through all the steps in your workflow or click on Check for errors to confirm that everything is aligned correctly.
- 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.
- 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.
- 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”