Sharepoint designer workflow association STSADM repair command
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
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:
- 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.
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.