I have recently been getting into the new workflow capabilities of Project Server 2010, which are basically SharePoint 2010 Workflows using Project Server activities.
There are 4 steps to creating your Project Server 2010 Workflow:
- Plan, Plan, Plan – you can never have enough documentation about the behaviour the customer actually wants. Visio really helps here.
- Create the Project Server primitives to support your workflow, in this order; Custom Fields (CF), Project Detail Pages (PDP), Phases, Stages and finally an Enterprise Project Type.
- Using Visual Studio 2010, create the orchestration of your workflow, tying together all the objects you created.
- Packaging and deployment; use the resulting WSP to deploy to your target.
This took some time to get to step 3 using Visual Studio to test out the workflow, and when I got there I was pleasantly surprised to see the first workflow be deployed and run mostly successfully. Obviously nothing works exactly right the first time, so as developers do, I changed some things and redeployed – this was where the fun began.
After Visual Studio retracted, redeployed and reactivated the solution the next attempt to run the workflow failed with an error indicating it couldn’t start the workflow. I quickly found that the workflow had become disconnected from the Enterprise Project Type:
Once discovered, its easy to just re-attach the workflow to the Enterprise Project Type, however this happens on every redeploy! If someone has a script to automatically hook this back up – let me know as I would be very appreciative!
After reattaching the workflow, it turned out that the old version of the workflow was still being initiated – so I thought an IISRESET would fix it. Nope, still the old workflow was running, no matter how many times I IISRESET or redeployed the solution.
It turns out, that when you redeploy a workflow, you need to restart the Project Server Queue Service, as it has the old workflow assembly still in memory.
To automate this in Visual Studio you need to add the following commands to your Visual Studio post deployment steps:
net stop ProjectQueueService14
net start ProjectQueueService14
Hope this saves someone some time!
J.