Migrate SPD Workflows

Quite often I need to copy a workflow to another site or site collection (e.g. when provisioning an intranet portal for another client). I usually use the method described here. It basically boils down to a few simple steps:
1) Open the target list/library in SPD, click New --> Workflow. Note: Obviously, all columns used in the source list or library must be present in the target one, also internal column names must match.
2) In the new workflow create 1 step that includes 1 condition and 1 action (e.g. If [field] equals 1, “Set field in current item” to 2).  This step creates the .xoml and .xoml.rules files needed to migrate our source workflow.
3) Open the original source workflow in SPD, open the .xoml file as XML (Right-click --> Open as .XML) and copy its contents.
4) Open the target workflow in SPD, open the target .xoml file as XML, replace the content with the content copied in step 3.
5) Do the same for the .xoml.rules file.

Normally after saving the files and opening the target workflow you will notice your workflow lookups display GUIDs rather than, as you would expect. fields, columns and parameters (see screenshot below). This is down to the fact that your .xoml and .rules files reference columns and lists used in the source workflow – if your target workflow is in a different site or site collection these will, obviously, not be recognized and, therefore, are displayed as GUIDs.
Old Solution:
Luckily, SPD is smart enough to re-map the workflow to the lists and columns in the current site. All you need to do is click on the GUID and press the “Add Lookup button” – you will see that SPD automatically finds the right list and field:
Pressing OK will update the field.
Now, this is all fine for a simple workflow – you just click and fix a few lookups and off you go. What if your workflow is a longer more elaborate one – containing many steps and even more lookups, especially ones looking up values in other lists? Suddenly, the above approach becomes quite a cumbersome one.

New Solution:
What I’ve been doing when dealing with longer workflows:
1) Follow the steps outline in the beginning of the post so you end up with .xoml and .xoml.rules files copied from your source workflow.
2) Make note of all the lists used in your source workflow, note their GUIDs. Do the same for the lists used in the target workflow.
TIP: You can use Sharepoint Manager 2007 to easily get the lists GUIDs
3) Open your new workflow in SPD, open the .xoml and .xoml.rules files as XML and replace the source GUIDs with the target ones.
That’s it – if you open your workflow now you’ll see all lookups display correctly and you no longer need to click through them all to have them updated.

I’ve been happily using the above approach for the last year or so. However, today I ran into an issue that didn’t really make much sense. I noticed that something funny happened if my workflow used the “Create List Item” action” (I guess the same will be true for “Update List Item” and “Copy List Item” actions).


You can see in the above screenshots  that all lookups are displayed
correctly. However, when I click on the “Tasks” lookup (first screen) to open the Create New List Item dialog box the List value was not populated (even though it’s shown properly in the first screen). Selecting the Tasks list from the drop-down menu had the effect of creating a new action – all the previously defined fields (Description, New Employee, Assigned to) disappeared and had to be put back in manually:
This was a major issue as I had over 20 steps using the “Create New List Item” action. I obviously didn’t like the idea of re-creating each of them manually. I opened the .xoml and .xoml.rules files and looked through the code, re-created the workflow in different sites a few times and tested all I could think of. I still couldn’t figure out what the problem is. Finally I spotted the culprit.

Turns out the lists GUIDs I pasted into the workflow’s .xoml files were in lower case. SPD was happy with that for all lookup fields. However, lower case seems to trip up the Create New List item action (and possibly other related actions – e.g. Copy List Item). The moment I changed my GUIDs to upper case (e.g. from fabe5a1-c8d0-4c72-8a66-46c6917abdb5 to 1FABE5A1-C8D0-4C72-8A66-46C6917ABDB5) things magically started to work fine – all field lookups and references mapped properly, no actions need updating. Bingo, I can now copy even large elaborate workflows in a few minutes!

Reference: SharePoint Applied


Michael Boggs said...

Thanks for this. Moving SP workflows is a major headache that I'm going through right now.

I have a quick question. Do you know if SPD will be ok if you just use ALL uppercase GUIDs? That way I don't have to identify only the create new list item ones.


Anonymous said...

Hi! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended up losing a
few months of hard work due to no data backup.
Do you have any solutions to protect against hackers?

Here is my web page ... bmr calculator

Anonymous said...

You see people passing time by checking on friends, catching up on texts or e-mail or playing
a video game oblivious to what is happening around.

The application Execution Environment provides an interface for application
programming. Dagar's invention will use quite the same technology.

Here is my site; samsung s4

Anonymous said...

The maintenance free batter operated fan operates at two speeds and clips
anywhere. This removes mold, dirt, fungi or other debris from entering the home.

The Sewing Kit found at RHL is a great buy found for under $5.

my blog post ... nest learning thermostat

Anonymous said...

It is almost like starting from scratch without reformatting the Apple - TV.
The built-in web browser of Google TV separates it from media streaming devices like apple tv.
The phone is allied with the some advanced sensors such as three-axis gyro,
accelerometer, proximity sensor and ambient light sensor.

Anonymous said...

Is it an advantage or disadvantage to save everything on
the web. What you need and prefer in a computer will determine if you will be satisfied with Chromebook or another computer.
Many years in the past the user had to write their programming code manually, using some cryptic

Here is my weblog: samsung chromebook review

Anonymous said...

Its appearance is note-bookish and minimalistic having no front button.
The thinking is much cases are questionable to be
settled within large bags time you length. You will get amazing discounts and thus saving
your money.

Look at my web page ... playbook review

Anonymous said...

If there is a ring around the moon, it will rain in as many
days as there are seeds left on the cutting room floor.

Also visit my site - bricecoq.free.Fr

Anonymous said...

Such addition shall greatly improve specific location detection typically, in addition to detecting location distance
relative to other objects. Year 2013 is essentially seen as the year that Smartphone will not only get an improvement on their processors but
their display will also be given a much needed boost in terms of size and higher resolution with improved pixel per inch.
Odin is thought to be preparing to roll into the market with the new Android 4.

My website - galaxy s4