HOWTO Move or Migrate SharePoint 2010 List-based Workflows between Sites and Site Collections

I’ve experienced this issue a lot when trying to migrate workflows between test SharePoint 2010 farms and production farms, in particular with workflows attached to lists. When moving a workflow to another site collection or server farm, the association to the list is broken and the workflow cannot be attached to the list. You also cannot use SharePoint designer to fix this via the standard methods as the unattached workflow cannot be reattached to the list.

List-based workflows are tied to three different lists – the “main” source list where the data is held (such as a Forms library or custom list), a task list, and a workflow history list. The latter in particular is tricky, because it is a hidden list and cannot be viewed via the normal interface.

The fix for this is to modify the source workflow files to force the workflow to reattach to the list. The following method assumes that your new site/location that you are moving the workflow too does not yet have any workflows already attached to any lists on the site. When a workflow is created in a site for the first time, a Tasks list and a Workflow History list are automatically created/used by the workflow. These lists must exist before you can force your migrated workflow to attach to the list.

Step 1 – Create a Blank Workflow

  1. Using SharePoint designer, connect to your destination site
  2. Create a new list-based workflow called “test” (or whatever), attaching it to your migrated list
  3. Create one condition (i.e. if 1 = 1)
  4. Create one action (i.e. add comment “hello”)
  5. Save and publish the workflow

After this step has been completed, your site will now have a Tasks list and Workflow History list.

Step 2 – Get the list ids for your new workflow

The list ids are required to configure your migrated workflow.

  1. Using SharePoint Designer, connect to your destination site
  2. in the left-hand side, in Site Objects, select All Files
  3. in the All Files list, select Workflows
  4. Select your new workflow that you just created (in this example, “test”)
  5. You should see (at least) four files:
    text.xoml
    test.xoml.rules
    test.xoml.wfconfig.xml
    test.xsn
  6. Right-click on test.xoml.wfconfig.xml and select Open With, Notepad
  7. Look for the <Association…> tag in the xml:
    <Association ListID=”{7DC232FD-4D0B-4F7B-AC72-3D4D6399147C}” StartManually=”true” TaskListID=”{CB551A8B-F1E1-49F9-A8F8-A2C8EDC241C7}” HistoryListID=”{04B19F9D-5A47-4E14-B85E-53FFF06CFA63}” StartOnCreate=”true” StartOnChange=”true”/>
  8. Record the Guid entries for ListID, TaskListID, and HistoryListID

Step 3 – Update the migrated workflow

  1. Still using SharePoint Designer, All Files, Workflows, this time select your migrated workflow
  2. You should again see (at least) four files. Right-click on “your-workflow.xoml.wfconfig.xml” and select Open with SharePoint Designer (As XML)
  3. Find the Association tag and very carefully change the Guids so that your migrated List IDs are the same as the “test” workflow List IDs.
  4. Save the file
  5. Close SharePoint Designer
  6. Open SharePoint Designer again and open your site
  7. Instead of All Files, this time click on Workflows
  8. Select your workflow
  9. Save the workflow
  10. Publish the workflow

Your workflow should now be reassociated with your list on your new site.

About these ads

10 Responses to “HOWTO Move or Migrate SharePoint 2010 List-based Workflows between Sites and Site Collections”

  1. Giorgio Says:

    You REALLY saved me!!!! thank you!
    I mentionned you in my blog!

    http://webdevshareetc.blogspot.com/2011/10/sharepoint-2010-migrate-list-based.html

    Thank you!!

  2. SharePoint 2010 – Migrate/Replicate Three-state List Workflows between Site Collections with PowerShell - Obilogic Blog Says:

    [...] http://gavinmckay.wordpress.com/2011/08/29/howto-move-or-migrate-sharepoint-2010-list-based-workflow… [...]

  3. Clayton Says:

    This was AWESOME! Saved me a lot of brain-ache. Thank you!

  4. Kelly Says:

    Perfect! Thank you.

  5. How to migrate SharePoint 2010 List based workflows « Joeprakash's Blog Says:

    [...] http://gavinmckay.wordpress.com/2011/08/29/howto-move-or-migrate-sharepoint-2010-list-based-workflow… [...]

  6. Alexander Gorlach Says:

    Or take the HarePoint Workflow Migration: http://www.harepoint.com/Products/HarePointWorkflowMigration/Default.aspx

    * Copy or move SharePoint workflows between any SharePoint sites.
    * Migrate SharePoint workflows between different SharePoint versions (2010 or 2013).
    * Multiple workflows migration
    * Advanced Workflow Migration Wizard
    * Export / import to file

  7. flotsamandthensome Says:

    Also remember to go under Start Options and check the boxes for: 1. Start workflow automatically when an item is created AND 2. Start workflow automatically when an item is changed. This will create the HistoryListID for your Blank Workflow.

  8. Is the workflow attached to the list when saved as a template? | Question and Answer Says:

    [...] What im trying to do here is migrate my list-based workflow to another farm… Found this thing in here: http://gavinmckay.wordpress.com/2011/08/29/howto-move-or-migrate-sharepoint-2010-list-based-workflow… [...]

  9. Jean-Christophe Says:

    Thanks a lot !! Sincerely

  10. Anthony DiFranco Says:

    Life saver!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: