How to: Install and Test a Project Server Workflow
Updated: July 2010
Workflows for Microsoft Project Server 2010 can be installed and tested on a local Project Web App server by using Microsoft Visual Studio 2010. Installation of workflows on production servers in a farm should use a SharePoint solution package.
This article includes the following sections:
The procedures in this article use the BranchingWorkflow sample described in How to: Create a Branching Workflow. After you test the workflow, you can deploy the workflow to a production installation of Project Server. For more information, see How to: Deploy a Project Server Workflow.
Installing a Project Server workflow for testing requires development on a test installation of Project Server.
Procedure 1. To install the workflow for testing
Open the BranchingWorkflow project in Microsoft Visual Studio 2010.
Right-click the project in Solution Explorer, and then click Deploy.
Visual Studio adds the workflow solution to the local Project Web App site collection and activates the feature. To verify that the feature is activated, in the Site Actions drop-down menu, click Site Settings. In the Site Collection Administration section of the Site Settings page, click Site collection features to see the Features page (Figure 1).
The default enterprise project template (EPT) that is installed with Project Web App is associated with the Sample Proposal default workflow. To test a custom workflow, you must create an EPT and associate it with the workflow.
You cannot change the workflow association for an EPT after it is created. To test a new workflow, you need to create another EPT.
Procedure 2. To create an EPT and test a workflow
On the Server Settings page in Project Web App, in the Workflow and Project Detail Pages section, click Enterprise Project Types, and then create an EPT:
On the Enterprise Project Types page, click New Enterprise Project Type.
On the Add Enterprise Project Type page, type a name and description for the EPT. For example, type Test EPT in the Name field.
In the Site Workflow Association drop-down list, click the name of the workflow that you added in procedure 2. For example, click BranchingWorkflow.
In the New Project Page drop-down list, select the page to show when a user creates a project that uses the EPT. For example, click Project Information.
If you want to have an icon in the drop-down list of EPTs that you use to create a project, add an image to an accessible SharePoint document library, and then add the Web address of the image. For example, if you add the P14SDK_small.gif file in an Images subfolder of the local Project Web App Shared Documents library, copy http://ServerName/ProjectServerName/Shared%20Documents/Images/P14SDK_small.gif into the text box for the Image section.
Click Save to create the EPT.
Create a project proposal by using the new EPT. In Project Center, click the Projects tab, and then click the down arrow below New (Figure 2).
If you just click New, you create an instance of the default project. In a standard Project Web App installation, the default project is Basic Project Plan, which does not have an associated workflow.
Click Test EPT for a new project that uses the example EPT that you created in the previous step. For example, name the new project BranchingWorkflow Test 1. Click Save in the ribbon.
Because Test EPT is associated with BranchingWorkflow, it starts under the control of the workflow (Figure 3).
Wait until the Project Server Queuing Service has created the project. If you get an Operation still processing modal dialog box, you can click OK and wait for the create operation to finish; or click Go to My Queue Jobs to see the job status. To start the workflow when the queue job is finished, click the project name in the Project Center view.
If all the queue jobs for the new project finish successfully, but you receive the following error, check that the stage GUIDs and other activity properties are correct in the BranchingWorkflow.cs file in Visual Studio.
Unable to open the project. The project has not been properly initialized. This may be caused by the workflow associated with the EPT not starting correctly.
Figure 3 shows that the workflow for the Initial Proposal Details stage is waiting for input because the workflow does not have the information that it needs to continue. The cost of the project and other required fields have not yet been entered in the Proposal Summary project detail page (PDP).
Click Proposal Summary, and then fill in the required information (Figure 4). In the Proposal Cost field, type a value greater than $25,000 to test the branch of the workflow that terminates the proposal.
To save the Proposal Summary data, click Save in the Project tab of the ribbon.
Optional: To view the workflow status, click Status.
Click Submit to advance to the next stage of the workflow. Because the proposal cost is greater than $25,000 limit specified in the BranchingWorkflow implementation, the workflow proceeds to the Automated Rejection stage (Figure 5), and then cancels the proposal.
Performing similar steps, create another proposal by using Test EPT. Try a cost less than $25,000 and see whether the workflow goes to the Proposal Details stage. When you have saved all of the required fields in the Proposal Details PDP, click Submit again. After filling in all the required details pages (Figure 6), when you click Submit the workflow should continue to the Execution stage and then show Workflow completed in the State column of the All Workflow Stages list. In the Execution stage, you can edit the project normally as a project manager.
Check the status of the workflow. In Project Web App, expand the All Workflow Stages node in the Workflow Status page of the project, and then click Additional Workflow Data below the All Workflow Stages grid. The Workflow Status: BranchingWorkflow page (Figure 7) shows the events that have occurred and the status of each event in the Workflow History section.
The BranchingWorkflow project is a simple example that has only one comparison test. The workflow involves three stages in the Create phase and one stage in the Manage phase of demand management. To thoroughly test a workflow, you must create an EPT that includes all PDPs the workflow can use and test all branches of the workflow to see whether the behavior is as expected.
While you are developing, testing, and revising a workflow, you can uninstall the workflow by using the Retract command in Visual Studio 2010. Right-click the BranchingWorkflow project in Solution Explorer. Install updated builds on the local Project Server development computer by using the Deploy command. When the workflow is complete, you can create a SharePoint solution file to install the workflow on all Project Web App servers and instances in a SharePoint farm. For more information, see How to: Deploy a Project Server Workflow.
Because Visual Studio 2010 can install a workflow solution on the local Project Server computer during development and testing, you can use Visual Studio to attach to a process that the workflow uses.
Procedure 3. To debug a Project Server workflow
After you deploy the workflow project in Visual Studio, on the Debug menu, click Attach to Process. In the Attach to Process dialog box, check Show processes from all users and Show processes in all sessions (Figure 8).
When you submit or restart the workflow, it runs in a w3wp process. Click one or more of the w3wp.exe entries in the Process column.
When you attach to the correct process, a breakpoint remains solid red in the left side of the Visual Studio code pane. If you do not attach to the correct process, the breakpoint turns into a hollow red circle with yellow caution indicator, and the tooltip for the breakpoint states, The breakpoint will not currently be hit. No symbols have been loaded for this document.
If the workflow creates a project or does another operation that uses one of the Queue methods in the PSI (for example QueueCreateProject), the process uses the Project Server Queue Service. In the Attach to Process dialog box, click the Microsoft.Office.Project.Server.Queuing.exe processes.
There is a queue process for the application server and for each Project Web App instance. You can attach to all the queue processes, or check the ULS log for the ID of the queue process, and then convert that into a decimal value. For example, if the Microsoft.Office.Project.Server ID is 0x0FFC in the ULS log, the Microsoft.Office.Project.Server.Queuing.exe process ID is 4092.
If the workflow uses an approval process that includes many approvers, it might run under the SharePoint timer process. Click the OWSTIMER.EXE process. This is not common.
When you click Attach and breakpoints turn solid red, Visual Studio is ready to catch the breakpoints that you set in the workflow code.