Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Applying a SharePoint Designer Workflow to multiple Lists

with 25 comments

When using SharePoint Designer to create a workflow you are required to bind the workflow to a particular list:

Wf1

The problem is that you cannot from this interface bind the workflow to other lists.

You might be tempted to use the “Save List as Template” option in the List’s settings, and then create a new list based on this template to create a list that uses the workflow. The problem is that the workflow is still bound to the list from which the new list is based, and an error will probably be generated whenever you try to start an instance of the workflow – the steps will try to reference items etc. in the original list.

In SharePoint Designer you can expand out the files associated with a workflow:

Wf3

The “.xoml.wfconfig.xml” file contains information on the list the workflow is bound to using the List’s ID (a GUID): 

Wf2

The file “.xoml.rules” contains the ‘conditions’ you program for the workflow and the “.xoml” file contains the ‘actions’. The “.aspx” form is displayed when the workflow is started manually.

To re-use a workflow in another list:

  1. Create a new workflow on the new list.
  2. Create at least one step, one condition and one action in this workflow. This ensures that the files shown above are created and they will be replaced by the next operations.
  3. From the original workflow open the .xoml file as XML and copy the entire contents to the clipboard.
  4. Open the .xoml file for the new workflow and replace the entire contents with the copy from (3).
  5. Repeat this operation for the xoml.rules file.
  6. Double click the .xoml file for the new workflow to open the workflow in the Workflow Designer and click Check Workflow to verify no errors and then click Finish to ensure the workflow is saved.

I’ve tested this technique with simple workflows and the process works well.

 

 

Advertisements

Written by Nick Grattan

October 17, 2007 at 12:08 pm

25 Responses

Subscribe to comments with RSS.

  1. Myself, I would be tempted to just add further Association tags to xoml.wfconfig.xml… Tried that and failed? Just curious. Haven’t tried it yet myself.

    Philipp Schumann

    February 26, 2008 at 10:26 am

  2. Philipp,

    Thanks for the suggestion which I have just tried. Unfortunately it doesn’t work – the additional tag is ingored.

    There is a SharePoint hidden list that stores information on workflows and it may be that an additional item needs to be added to this list.

    Regards,

    Nick.

    nickgrattan

    February 27, 2008 at 12:58 pm

  3. Hello Nick,
    Our school has different approvers for each dept. and I’d like to use one standard form I was wondering if it is possible for the Form User, at runtime, to add the required Workflow Approvers to the form and the workflow approvers property is populated with the entries?

    RalfDeC

    May 19, 2008 at 9:44 am

  4. This worked perfectly. You just saved me many hours of duplicating a very complicated set of workflow actions for processing new employees.

    Thanks a bunch!

    -Steve

    Steve Sherman

    October 16, 2008 at 8:41 pm

  5. thnks so much ….

    Mohammed

    December 19, 2008 at 5:56 am

  6. Even though this approach would work for you, it still doesn’t allow you to move the workflow between sites. So you’ll still have to be within the same site to leverage this XOML capability. Template is the approach that I’ve seen that works well when dealing with this issue.

    Leonard Mwangi

    December 22, 2008 at 10:59 pm

  7. You are AWESOME! It worked! Thank you so much!

    Maya Green

    March 19, 2009 at 7:14 pm

  8. AMAZING!!!!!

    Craig

    April 15, 2009 at 12:17 pm

  9. […] and especially the one about copying an SPD workflow from one list to another. […]

  10. […] (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 […]

  11. Hi ,

    First of All thanks.

    Actully My requirment is somethign diffrent . I have copy workflow from My Test Environment to Production Server.

    So i have find and Replace all List Id and Task with Current one …

    Thanks for Reference …..

    Pritesh Gandhi

    August 17, 2009 at 9:10 am

  12. […] no errors and then click Finish to ensure the workflow is saved. Original post on Nick Grattan's […]

  13. Thanks a lot, very useful post.

    Abdullah

    April 14, 2010 at 5:53 pm

  14. […] Applying a SharePoint Designer Workflow to multiple Lists « Nick Grattan’s SharePoint Blog (tags: sharepoint) […]

  15. I thought I did this in development and it worked flawlessly. But moving from development to production, not so much.

    I thought that I created a dummy workflow and copied the GUID info FROM the dummy workflow to the worklow created from a template in the new site on the server. but that isn’t working.

    I created a site from a template on the new server with workflows. now to get these workflows to work on the new site… I have to search and replace which GUIDs specifically? Because copying and pasting from the old to the new is failing to load.

    Stefanie

    February 1, 2011 at 2:40 pm

  16. and I don’t remember copying the whole rules file from one to the other. I remember copying just the association section from the new one to the old one.

    Am I remembering wrong? probably.

    I have a lot of customizations on my approval apx page ,etc and I want to update the actualy workflows, not create new ones and copy from old to new, but update what I need to from new to old.

    does that make sense?

    Stefanie

    February 1, 2011 at 2:45 pm

  17. Copying the whole set of rules and configurations from one workflow to another means you are copying the list id as well. Doesn’t work!

    Sam

    October 5, 2011 at 2:47 am

    • True Sam. You need to change the ID on the 3 documents. I was able to make it work by copying and paste the workflow, then editing each of the 3 files – find and replace old list ID with new ID.

      Marcius

      October 26, 2011 at 4:41 pm

  18. Is there any way to achieve this from code and not relying on SPD?

    Arpit

    September 7, 2012 at 8:54 pm

  19. […] en este caso la lista era muy pequeña y no quería hacerlo de esta manera. Así que encontre este post de Nick Grattan y solucionó mi […]

  20. Thanks you .
    This was really helpful for me and saved me a lot of time and efforts.
    Amazing
    🙂

    You rock

    Ravi M

    October 9, 2012 at 9:24 pm

  21. Thank you for sharing the information! This approach worked for List Workflow 2010 (created with SPD 2013) in SharePoint 2013 on-premises environment.

    Alex Seliv

    February 1, 2016 at 4:11 pm


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

%d bloggers like this: