Fixing the ‘Failed on restarted (retrying)’ error with corrupt SPD workflows after restore from template

This post describes an issue of using custom created SharePoint designer workflows when trying to instantiate a previously saved site with SharePoint designer workflows. As a result of this limitation, SharePoint designer workflows won’t start due to incorrect versions of files. This post describes a technical plus pragmatic workaround and provides an utility to fix this. Therefore enabling the re-use of workflows in sites that are saved as template and instantiated.


Pfew! Look at that sentence full with buzzwords. As everyone knows we can create workflows easily in SharePoint Designer (SPD). However, after some modifications and we wish to save the site as template and later restore it, the workflows do not seem to work on the newly created site. The error is something like: Failed on Start (retrying). This is because the versions of the workflow files and the workflow association config xml doesn’t correspond anymore. I’ve created a little STSADMCOMMAND that repairs this association by opening the configuration file, synchronizing version information and saving it back to the server, it also re-attaches the workflow using the WebPartPages webservice, which basically the same SOAP command when you are editing workflows in SPD and saving them. This tool comes in quite handy if you need restore loads of workflows on a site.

The command for this STSADM command is:

stsadm.exe -o repairworkflowassociations -url <url of site where WF are broken> [-resetversions]

The url parameter is the parameter of the web that need its workflows repaired.
The resetversions basically sets the version of the workflows back to 1.0.

So you can save your templates and let fix the workflow the following way:

1. Create a site, edit your workflows as you like.
2. When you are done save your site as template
3. Instantiate your template somewhere else, try to start the workflow, see it fail.
4. Run the tool, on that site. It should correct the workflow.
5. Run the workflow again, it should work now.

Optionally you could also run the tool with the -resetVersions option. This saves the workflow files as version 1.0. If you save that template, and instantiate the site using that template. The workflow will work, and every site instantiated with that template will work. Be sure to run it in the instantiated site and not in the site you are authoring your workflow because it will destroy the WF version history. WARNING: If you use the -resetVersions option, the workflow version history will be destroyed, so make sure to create an backup.

Download the WSP file here.

NOTE: The WSP file hasn’t been thoroughly tested yet, if you find any bugs, please send me an e-mail. I’ll post the source later..

And the now pragmatic approach if you dont have too many WFS: You could also save your template, instantiate the new site using that template, disable versioning in Sharepoint Designer on the workflows list (right click, properties), open each workflow and  save it using SharePoint designer. Save that template, that template can also be instantiated.

This need to be done in that exact order.

Advertisements

4 Responses

  1. Would you be willing to share your code for your STSADM utility repairworkflowassociations? We have written a custom workflow activity that provisions SharePoint sites based on site templates and it would be great if we could bake this repair code into our provisioner to fix up site instances that were created from templates which contained SPD workflows. Thanks in advance for any help you may provide

  2. Great post! Solved our problem like a charm:)

    I’ve recomended this for others in my blog. Hope this is ok.

  3. Finally!!!

    This is what I was looking for a real long time!!..
    Thank you very much!!

    I am going to check it out, but i love it already! đŸ™‚

    Good job

  4. Back here again to get this great tool đŸ™‚ Hopefully they have resolved the need for things like this in SharePoint 2010!

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: