This documentation is archived and is not being maintained.

Solution Starter: BizTalk Server Workflow

Office 2003

Ameya Bhatawdekar
Microsoft Corporation

December 2003

Applies to:
    Microsoft® Office Project Server 2003
    Microsoft Office Project Professional 2003

Summary: Use the BizTalk Server Workflow Solution Starter to add workflow to Enterprise Project Management. This article can guide you in developing workflow-enabled applications using Microsoft Office Project Server 2003 and Microsoft BizTalk Server 2002. (9 printed pages)


Executive Summary
Workflow Solution
Components of the Workflow Solution

Executive Summary

In today's business environment, every organization adapts and customizes standard business processes to meet their unique business requirements. These business processes are continually changing and no two organizations are quite the same; and enterprises practically always require customizing and extending of their enterprise software. The same holds true for Enterprise Project Management (EPM). Microsoft® Office Project Server 2003 is the tool for EPM and customization. Project Server provides the flexibility and the programmability for easy customization and sharing of data with other systems. Using Project Server 2003 as a platform, organizations can develop business applications that automate their business processes.

Microsoft BizTalk® Server provides organizations with servers, tools, adapters and vertical accelerators needed to integrate and automate their businesses. By allowing easy integration of data, applications, and business partners, BizTalk Server makes it easy to achieve business process automation and integration. BizTalk Orchestration Designer and the Orchestration Engine allow workflows to be managed easily; applications can easily model the frequently changing business processes with very little developer effort.

This article describes how you can build BizTalk Server enabled workflow applications using Project Server 2003 as a platform. To see the complete BizTalk Server Workflow Solution Starter see the Microsoft Office Project 2003 SDK. You can develop applications with workflow logic using the BizTalk Orchestration Designer and the BizTalk Orchestration Engine; and project data and methods can be accessed by making Project Data Service (PDS) calls against the Project Server.


Microsoft Office Project Server 2003 includes a timesheet application that allows multiple individuals to approve submitted timesheets. The timesheet application is frequently customized and extended by enterprises to suit their requirements. In the out-of-the-box timesheets implementation, submitted timesheets must be approved by the project manager to be marked as accepted and to update the actuals. The out-of-the-box timesheet workflow may not be usable by all organizations, and some customization might be necessary to mirror a specific timesheet business process. Project Server 2003 has new timesheet-related PDS APIs that make it easy to develop alternative timesheet solutions. The timesheet-related PDS APIs are:

  • AssignmentsGet
  • AssignmentsSave
  • AssignmentsProjectManagerUpdate

BizTalk Server 2002 provides a workflow design surface that makes it very easy for a business analyst to define the business process in terms of a flowchart. The design application is called BizTalk Orchestration Designer and it is a Microsoft Visio® 2000-based tool that allows composition of workflow diagrams. Implementation, in the form of COM or script components, can be associated with workflow drawings in the Orchestration Designer. The messaging framework can also be linked with the workflow diagram depicting how data flows in and out of the application. The drawings are compiled into XLANG schedules which are then run by a service called the XLANG Scheduler Engine.

BizTalk Server makes it very easy to change the implemented business process. A business analyst or a developer can update the workflow orchestration diagram to reflect the changes and recompile the diagram into its XML representation. This reduces the redevelopment effort significantly whenever there is a change in the basic business process.

Workflow Solution

This article describes a timesheet workflow application that is developed using Microsoft BizTalk Server 2002 and Microsoft Office Project 2003. This application allows business analysts and developers to easily change the timesheet workflow to support different types of approval processes (sequential or parallel) and the ability to easily change business rules associated with the approval processes, such as requiring approval from either of the approvers or from all the approvers.

Scenario: A. Datum Corporation

Ryan, a consultant working for A. Datum Corporation, logs on to the Project Server on a Friday afternoon to submit his hours for the week. He fills in the hours against the assignments and submits the timesheet for approval by his project manager and the resource manager. An e-mail message is sent to Willis and Debra notifying them that a timesheet is waiting for their approval. Debra logs on to the Project Server; on the home page, an "Updates" record for a assignment is pending her approval. She views the details of the timesheet submitted by Ryan. She sees that Ryan has logged 20 hours against a single assignment on Monday and has not logged any hours against another assignment. Debra rejects the timesheet with a note asking Ryan to fill in the correct details. Because the timesheet has to be approved by Willis and Debra; the timesheet is no longer available for approval by Willis when he logs onto the server.

Ryan resubmits the timesheet with the correct hours. Debra logs on to the Project Server and approves the timesheet. When Willis logs on to the server, he sees that a timesheet is pending his approval. He clicks on the link to go to the timesheet approval page. He approves the timesheet, and updates the actuals.

Later on in the year, Ralph, the practice director, decides that the timesheet workflow needs to change to suit the business; now, the timesheet may be approved by either the project manager or the resource manager, and conversely, a single rejection is required to abort the workflow. Amy, the Project Server administrator, launches the workflow designer and loads the timesheet workflow. She redesigns the orchestration to implement the "OR" approval process, compiles the orchestration, and deploys the modified XLANG schedule to the BizTalk Server. From now on, as soon as either the project manager or the resource manager has approved the timesheet, the project plan as well as the payroll systems can be updated with the actuals.

Note   Alternatively, Ralph could decide to have an "OR" approval process, so that the project manager may approve a submitted timesheet assignment only if it has been approved by the resource manager. If the resource manager doesn't approve the submission, the workflow process should be aborted and the user should resubmit after modification.

Overview of the Workflow Solution

The custom timesheet application allows the administrator or the business analyst a way to easily change the flow of the approval processes without requiring any significant redevelopment effort.

The timesheet approval business process is represented as a BizTalk XLANG schedule. An XLANG schedule represents the business process and contains the implementation details. An XLANG schedule is implemented by connecting each step in the process to a technology component or service that executes the step. The XLANG schedule is run by a service called the XLANG Scheduler Engine, which controls the instantiation, execution, dehydration, and rehydration of an XLANG schedule.

In this implementation, the timesheet data is submitted through a simple Active Server Pages (ASP) page. The timesheet data is posted to the server and is transformed into well-formed XML. Each submitted assignment is represented as its own XML document. The XML document conforms to a timesheet assignment schema and contains information such as unique identifier for the assignment and the resource ID. The XML documents are submitted to a Message Queuing (also known as MSMQ) message queue. A workflow instance is created from the server code for each of the timesheet assignments and this workflow instance polls the queue for messages in the queue. The XML message is picked up by the workflow instance. The timesheet assignment follows the approval route as depicted in the XLANG schedule. Approval or rejection messages from the approvers are correlated to the running instance and the workflow is advanced.

The data is also saved to the state tables that store the state information for the timesheet. Instead of appending state information to the XML document; the data is stored in SQL tables as an optimization. The correlation data is also stored in the database.

The project manager and the resource manager submit the approval through a Web-based front end as well. When a submitted timesheet requires the project or the resource manager's approval, a message indicating that a timesheet is awaiting approval is displayed on the application home page for the approver. The approver can click on the link to view the timesheet details. Each submitted assignment may be approved or rejected independently. When an approval or a rejection message is submitted; it is sent to the workflow instance.

The correlation between the approval/rejection message and the running instance of the workflow is provided by the correlation ID that is stored in the state table. The correlation ID is a GUID that identifies a running instance of the workflow. By setting the label property of the message to the GUID, the BizTalk Orchestration Engine is able to correlate the message to the workflow instance.

When the timesheet is approved, the data on the Project Server is updated. The project data is updated through the PDS and the PDS Extender calls.

Components of the Workflow Solution

The architecture of the BizTalk Server Workflow Solution Starter allows a business analyst or a developer to easily change the flow of the timesheet approval process without requiring any significant redevelopment effort. This architecture is made up of Microsoft® BizTalk® Server services, Microsoft Office Project Server 2003, Microsoft SQL Server™ 2000, and Message Queuing (also known as MSMQ). The following section provides details of these components and the reasoning behind the design choices that were made for each component.

BizTalk Server Components

Workflow Orchestration

BizTalk Orchestration Designer is a Microsoft Visio 2000–based design tool that enables you to create business process drawings that can be compiled and run as XLANG schedules.

BizTalk Orchestration Designer is used to create drawings that describe long-running, loosely coupled, executable business processes. Typically, these drawings describe the way interactions and procedures are performed during the completion of a specified process, such as a purchase order request.

The XLANG schedule for the timesheet application implements three types of approval process supporting the scenarios discussed in the Scenarios section. The following figure is the XLANG drawing for the parallel (AND) timesheet approval business process. Each timesheet assignment needs to be approved by the project manager and the resource manager. The sequence of approvals does not matter.

Click here to see larger image

Figure 1. Parallel (AND) approval process (click picture to see larger image)

By changing the XLANG schedule, the business process can be easily changed to reflect the "OR" approval processes. In this workflow, either the resource manager or the project manager can approve or reject the timesheet assignments. The changes in the business process are insulated from the actual implementation, which is in the COM objects, PDS extenders, and the PDS APIs. This change involves almost no redevelopment.

Click here to see larger image

Figure 2. Parallel (OR) approval process (click picture to see larger image)

The business processes can also be changed to implement a sequential approval workflow by making changes to the XLANG schedule. In the sequential workflow, assignments approved by a project manager are forwarded to the resource manager for his or her approval.

Click here to see larger image

Figure 3. Sequential approval process (click picture to see larger image)

COM Components

The BizTalk Server Workflow Solution Starter uses the following COM components: GetApprovers, NotifyApprover, and UpdateApprovalStatus. These components are defined in the TimesheetBTSTalker.DLL and are used to perform actions within the XLANG schedule. The components make Project Data Service (PDS) and custom PDS Extender calls to get the approvers for a timesheet, update the home page of the approvers to notify them when there is a timesheet waiting for their approval, and update timesheet approval status information in the SQL Server database.

Note   In and Out messages are associated with each COM component shape. These define the flow of messages between the Action shapes and the COM component shapes.

Messaging Queues

BizTalk Server 2002 provides transport services that enable the transmission of XML documents to their destinations. BizTalk Server supports the following transport services: HTTP/S, SMTP, File, MSMQ, AIC and loopback.

When a user submits a timesheet, each of the assignments is formatted into an XML document and is submitted to a private message queue, ".\private$\Port_RcvSubmittedTS". The approval orchestration receives the XML document from this message queue.

Similarly, the approval/rejection messages from the resource manager and the project manager are received at the ".private$\Port_RcvApprovedTSFromRM" and ".private$\Port_RcvApprovedTSFromPM" message queues respectively. These messages are annotated with the unique identifier that correlates them to the running instance of the workflow. The label property of the messages is set to the GUID.

State Tables (SQL Server)

State information is persisted in SQL Server. The TS_Approvals and TS_Status tables hold the state and the approval information for every timesheet assignment that goes through an approval workflow.

The TS_Status table stores the unique identifier for each instance of the workflow. When a resource manager or project manager submits an approval/rejection message for a specific timesheet assignment, the unique identifier for the workflow instance associated with the assignment is looked up from the TS_Status table.

Table 1. TS_STATUS

WASSN_ID (int)
WRES_ID (int)
WF_ID (uniqueidentifier)

The TS_APPROVALS table starts the approval status for each timesheet assignment.


WASSN_ID (int)
APPROVAL_Role (uniqueidentifier)


The submitted timesheet data is transformed into an XML document for each of the assignments in the timesheet. The XML conforms to the SubmittedTS XML Schema. Each document that is submitted to the workflow is validated against this schema.

Click here to see larger image

Figure 4. SubmittedTS.xml (click picture to see larger image)

Each approval/rejection message is validated against the ApprovedTS XML Schema. The validation is shown in the following figure.

Click here to see larger image

Figure 5. ApprovedTS.xml (click picture to see larger image)

Microsoft Office Project Components

Project Data Services Modules - Timesheet APIs

The PDS acts as the gateway for accessing Project Server. It is a middle-tier component hosted within Microsoft Internet Information Services (IIS). The PDS receives XML requests, maintains a connection on behalf of the client to the Project database, queries the database, and then returns an XML response to the client. For instance, the AssignmentsGet PDS API is called when the timesheet UI is populated for the user when he or she submits time against their assignments. The API call returns the list of the assignments for the user.

Custom PDS Extenders

In addition to using the standard PDS API, the BizTalk Server workflow application implements custom PDS Extenders. Making calls to PDS Extenders is no different from making method calls to the PDS itself, and method calls take the form of XML requests. By using the same interface you also get the additional benefit of Project Server security, which ensures that project data stored in the database remains consistent.

The following table briefly describes the custom PDS Extenders.

Table 3. Custom PDS Extenders

PDS Extender name Description
AssignmentsSubmit If a record doesn't already exist, creates and inserts a new record into the tables TS_Status and TS_Approvals, along with the information of the approvers (PM, the Project Manager of the assignment; and RM, the Resource Manager in charge of the resource based on RBS structure). Otherwise, AssignmentsSubmit updates the records with the updated information.
AssignmentsApprovalUpdate Updates the approval status from the approver for the task assignment in TimesheetWorkflow table TS_APPROVALS. If this is the final decision, AssignmentsApprovalUpdate updates the final approval status of the task assignment in table TS_STATUS. If the final decision is accepted, AssignmentsApprovalUpdate updates the MSP_WEB_TRANSACTIONS table on the Project Server so that the assignment actuals can be updated through Microsoft Office Project 2003.
GetApprovers Returns information about the approvers of the submitted assignment by running a query against the Project Server database.
AssignmentsToApproveOrUpdate Returns the assignment IDs for the specified user to approve or update. AssignmentsToApproveOrUpdate runs a query against TimesheetWorkflow database to get the submitted timesheets for a given user.
AssignmentsWorkflowInfoGet Returns the correlation ID of the workflow schedule for a given timesheet submission by running a query against the TimesheetWorkflow database.

Updating Project information

The project manager can update the actuals for the approved timesheets. In order to do so, she or he needs to start Microsoft Office Project 2003 from the client and publish the actuals to the Project Server. The approved timesheet assignments page contains a link that starts Project 2003 and updates the actuals.


Microsoft BizTalk Server 2002 provides a powerful development and execution environment that integrates loosely coupled, long-running business processes from the enterprise to the Internet. BizTalk Server 2002 features include the ability to design and execute state-full business processes in the form of XLANG schedules, integrate existing applications, define document specifications and specification transformations, and monitor and log run-time activity.

Microsoft Office Project Server 2003 provides a programmable interface through the PDS that allows applications to access Project data. The PDS is extensible and allows developers to extend the APIs to provide additional functionality. By consuming PDS and developing PDS extensions, developers can use Project as a platform on which to build their applications.

Using BizTalk Server and Project, you can extend the out-of-the-box workflows to provide custom solutions. The timesheet solution starter is highly customizable and does not require redevelopment whenever a business process changes. By decoupling the business rules from the implementation, the logical components are insulated from the changes to the business processes.