17
Jun
08

Workflow in SharePoint Project Server templates

Apparently this isn’t as simple as it should be.

The environment:

Project Server 2007 with SharePoint v3. Each Project has a SharePoint subweb as a “Project Workspace”. The Project workspaces are provisioned automatically by Project Server. Project Server applies a template to the new workspaces. The template can be customised but must be derived from the one Project Server originally shipped.

The scenario:

Put workflow into the template so that each provisioned Project workspace starts with a number of pre-defined processes

Shouldn’t be hard right? Well, it was.

The problem wasn’t making the very complex workflow in SharePoint Designer (which was amusing, and fun… 20 step workflow of many branches).

The problem was keeping the workflow working when the Project workspaces were provisioned.

What we saw was that all workflows in the provisioned sites would return with the error:

Failed on Start (retrying)

And digging around the SharePoint logs ( C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Logs\ ) revealed that the error being thrown under the hood was:

RunWorkflow: Microsoft.SharePoint.SPException:
<Error>
	<CompilerError Line="0" Column="0" Text="Activity 'ID85' validation failed: Can not find the condition "__Rule_ID85"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID636' validation failed: Can not find the condition "__Rule_ID636"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID624' validation failed: Can not find the condition "__Rule_ID624"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID630' validation failed: Can not find the condition "__Rule_ID630"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID162' validation failed: Can not find the condition "__Rule_ID162"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID488' validation failed: Can not find the condition "__Rule_ID488"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID428' validation failed: Can not find the condition "__Rule_ID428"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID579' validation failed: Can not find the condition "__Rule_ID579"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID580' validation failed: Can not find the condition "__Rule_ID580"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID458' validation failed: Can not find the condition "__Rule_ID458"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID609' validation failed: Can not find the condition "__Rule_ID609"." />
	<CompilerError Line="0" Column="0" Text="Activity 'ID610' validation failed: Can not find the condition "__Rule_ID610"." />
</Error>
at Microsoft.SharePoint.Workflow.SPNoCodeXomlCompiler.LoadXomlAssembly(String assmNameIn, SPWeb web)
at Microsoft.SharePoint.Workflow.SPWinOeHostServices.CreateInstance(Guid trackingId, SPWorkflow workflow)
at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)
at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflowElev(SPWorkflow originalWorkflow, SPWorkflow workflow, Collection`1 events, SPRunWorkflowOptions runOptions)

Googling the error that was displayed to the end user revealed nothing, but the underlying exception led me to the UK SharePoint User Group.

The advice from there:

  1. Open your site in SharePoint Designer
  2. Expand the ‘Workflows’ folder, and the folder containing the workflow you want to fix
  3. Right-click on the file that ends in ‘xoml.wfconfig.xml’
  4. Choose ‘Open With’ -> ‘SharePoint Designer (Open as XML)’
  5. Look for the ‘RulesVersion’ attribute
  6. Change its value to ‘V1.0′
  7. Save the xml file
  8. Close the site

Well I gave that a go, saved the template and re-deployed it as the provisioning template… and whaddya know… it worked!

Another note from that post: If you modify the workflow again, you’ll have to change the ‘RulesVersion’ attribute again before saving as an STP as changing the workflow increments this attribute value which has to be reset to ‘V1.0′.

It seems that unless the version is 1.0 on a new site, the workflow breaks. That simple. So in the template you must make sure that the version always remains 1.0.


0 Responses to “Workflow in SharePoint Project Server templates”


  1. No Comments