Import-Export SPD Workflows

May 22, 2009 at 12:09 PM
Edited May 22, 2009 at 12:14 PM

Hi,

I am trying to export-import SharePoint Designer workflows using this utility. I imported lists by "retaining object IDs and locations" and imported workflows "without retaining object Ids and locations".

I exported workflow and supporting lists from http://machine1 and imported on http://machine2. This worked fine except I have to open the workflow in SPD and click ‘Finish’ to deploy it.

But when I exported workflow from http://machine1 and imported to http://machine3/sites/Test, then following are observations:

  1. The aspx page used to run workflow manually is not found. If we delete this page from SPD and redeploy workflow, then this page works.
  2. The edit item link on tasks created by workflow does not work. Again page not found. If we delete ‘collect data from user’ action from workflow and recreate it, deploy workflow, then edit item link works.

After looking at this issue, I observed:

  1. The content types those imported along with task list are not added to site content types. Same is the case for site columns.
  2. The links for aspx pages those are not found are wrong. They are pointing to root site i.e. http://machine3 instead of http://machine3/sites/Test.   

Do you have any idea about this? Can you give some pointers?

Thanks,

Rashmi

Coordinator
May 25, 2009 at 10:03 AM

Hi Rashmi,

It sounds like you're getting close, but I think fundamentally the underlying SharePoint API which the Wizard uses just doesn't support deploying workflows. The way I think about things is that SPD workflows cannot easily be deployed, so if I need workflows which can be deployed through environments I need to look to VS workflows or some 3rd party solution.

In terms of your findings with site columns/content types, you're absolutely right. What happens is the deployment API recreates the list columns and content types (i.e. the child columns/content types) so everything does still hang together and works fine, it's just that things aren't structured in exactly the same way as the source environment as the site columns/content types are not created. I've learned to live with this as it doesn't have any material effect on how the site works and doesn't actually cause any issues in my experience.

HTH,

Chris.

May 26, 2009 at 7:02 AM

Hi Chris,

Thanks for the reply.

The msdn documentation on content migration API says that it does not support workflow tasks and workflow state. But nothing is mentioned about workflows. In the wizard, I updated App.config to override ListsNotForExport and I could export the workflows. Now we are facing two problems:

  1. Import on root site works fine except I have to click 'Finish' in SPD to deploy the workflow. Can I get solution to this using some API like SPWorkflowAssociation or so?
  2. Import on site collection under sites did break on edit of task created using custom content type. My guess was may be this is due to site columns/content types not created through import. If that is not the cause, then is there any dependency that if you export from root site of one machine, then you cannot import on subsite of another machine? I have observed one more point that might throw some light on this. When we view any task that is created using custom content type, then there are links on the top for edit item, delete item etc. If I check url for edit link then it calls javascript STSNavigateWithChekcoutAlert with url workflows\MyWorkflow\MyTaskPage.aspx. Ideally this should be sites\MySite\workflows\MyWorkflow\MyTaskPage.aspx. But this does not happen on import. If I delete the 'collect data from user' action from my workflow and recreate it after import, then the url gets corrected and everything works fine. Can you give some pointers to solve this problem?

Earlier we were performing manual export/import through SPD and it was really a very tedious task. Using this wizard lot of this pain is avoided. Now it's just matter of solution to couple of above problems and there will be nothing like it. :) If you can help us in this then that would be great!

Thanks again,

Rashmi

Coordinator
May 26, 2009 at 10:12 PM

Hi Rashmi,

This definitely is an interesting approach, but I'm just not sure about all the bits and pieces needed for SPD workflows to function properly.

Certainly on your question 1, yes I agree that some extra code (after the Wizard) should be able to do this step - you could potentially modify the Wizard code to add your step. On your question 2, are you setting the "import web URL" in the Wizard on import? I would guess this should be set to "sites\MySite" in your example - this might help, not sure. Otherwise maybe this is an instance where the site column/content type is needed? It would be the first instance of SharePoint functionality I've seen where the list column/content type is not sufficient, but maybe this is the underlying reason why the content migration API doesn't appear to support moving workflows? Afraid I just don't know enough about SPD workflows to help on this one really.

Good luck though..

Chris.