The Workflow Designer in Office XP Developer


To help you more quickly develop workflow applications, Microsoft has introduced a new version of the Workflow Designer in Office XP Developer Edition. The new version of the Workflow Designer adds some new productivity enhancements for building workflow applications, and it can still import and modify your existing workflows built using the previous version of the Workflow Designer. Figure 17-17 shows the new interface for the Workflow Designer.

click to expand
Figure 17-17: The new Workflow Designer in Office XP Developer

The first thing you will notice about the new designer is that the interface looks like the Visual Studio .NET interface. The Office XP Developer team took the Visual Studio .NET shell and used it as the basis for their new version. This means you get all the new shell enhancements that Visual Studio .NET supports. It does not mean that you get all the new features of Visual Studio .NET (such as C# and Web services development). You simply get used to the Visual Studio .NET shell by using Office XP Developer. If you want the Visual Studio .NET feature set, you have to buy Visual Studio .NET.

The new Workflow Designer has no new events or object models, but it has new security fixes and new functionality, such as the URLMapper support in workflows and development feature enhancements. We'll look at some of these enhancements next .

Coding Enhancements

One of the most exciting changes to the designer is that you now get a real coding environment instead of the Notepad-like environment in the previous version. With this version, you have color coding of your code, which makes it much easier to read through the code and understand where your functions and subs are, as well as your comments.

The code editor also supports autocompletion of your statements and IntelliSense. IntelliSense works just like in Visual Basic. When you start typing code, the IDE tries to help you complete that code or display parameter information when you type a function. You can also show class definitions and comments when you hover your cursor over a function. An example of code completion is when you type the word WorkflowSession in your code. The code editor displays the available methods and properties for the WorkflowSession object so you can quickly select one. An example of displaying parameters is when you type the InStr function. As soon as you type the parentheses for that function, the code editor displays the necessary parameters for the function as a tooltip.

Another new feature in the Visual Studio .NET shell used by Office XP Developer is code outlining. You can select multiple lines of code and collapse that code. If you want to see the code again, you can expand that section of code. This feature makes it much easier to read your code by allowing you to collapse code that you are not currently interested in. These and many other features make using the code editor much more efficient.

Enhanced Design Environment

Beyond making the code editor easier to use, Office XP Developer also has an enhanced Workflow Designer user interface. The new development environment offers drag-and-drop creation of all the different workflow primitives, such as states, transitions, and comments. When you double-click on any of these primitives, you are automatically launched into the code editor to modify the code for that primitive. For example, if you double-click on a state, the designer will automatically create the stub for the OnEnter event in your code and place you in the middle of that stub so you can write your specific handler code for that event. The previous version did not do this.

The designer toolbox, which is part of the development environment, also supports templatized workflows. This means that if you have a common element or elements that you use in multiple workflows, you can select those elements and drop them on the designer toolbox. Then you can just drag and drop the new toolbox item onto a new workflow and suddenly you will have the elements you added to the template. This makes it easier to reuse your common workflow states and transitions. Plus, it allows you to build up a rich toolbox from which you can quickly create workflows by leveraging common workflow templates.

A Seamless Upgrade

One nice thing about the workflow designer in Office Developer XP is that you can import your workflows that you built using the previous version of the designer. The new designer asks you if you want to translate the previous version's format into the new version's. It also migrates your code from the previous version to the new version. With this feature, you can quickly get your previous workflow designs into the new tool.

Some New Concepts

You will have to get used to some new concepts in the new designer. First and foremost is that the condition expression and action script procedure windows are gone. These windows have been replaced by functions that get called in your script code. For example, say you have an action called Change1 . Previously, you would write your condition expression in the condition expression window, as in this example:

 WorkflowSession.Fields("http://thomriz.com/schema/" _                        & "approvalstatus").value = "Rejected" 

Then you would write your action script procedure in the action script procedure window, as in this example:

 strCourseName = GetCourseName strStudentEmail = GetStudentEmail strManagerEmail = GetManagerEmail strBody = "Your manager rejected you for the course: " & strCourseName sendMail strBody,strStudentEmail & "," _          & strManagerEmail,"Rejected for course: " & strCourseName 

With the new designer, you instead create functions and subs for both of these events. For example, your condition expression becomes a Validate function, such as Change1_OnChangeValidate . You must specify what makes this function true , and if the function is true , the OnChange sub for the element will be called. The OnChangeValidate function for Change1 is shown here:

 Function Change1_OnChangeValidate()     bRetVal = CBOOL(WorkflowSession.Fields("http://thomriz.com/schema/" _                     & "approvalstatus").value = "Rejected")     Change1_OnChangeValidate = bRetVal End Function 

Your action script procedure becomes an OnChange sub, such as Change1_OnChange , as shown here:

 Sub Change1_OnChange()     strCourseName = GetCourseName     strStudentEmail = GetStudentEmail     strManagerEmail = GetManagerEmail     strBody = "Your manager rejected you for the course: " & strCourseName     sendMail strBody, strStudentEmail & "," & strManagerEmail, _              "Rejected for course: " & strCourseName End Sub 

Finally, if you have a compensating action for Change1 ”so that if your code or an external component fails and the state of the workflow needs to be rolled back ”you must implement an OnChangeRollback sub. In the previous version, you would implement a compensating action. The OnChangeRollback sub is shown here:

 Sub Change1_OnChangeRollback     WorkflowSession.AddAuditEntry "Failed!!!" End Sub 



Programming Microsoft Outlook and Microsoft Exchange 2003
Programming MicrosoftВ® OutlookВ® and Microsoft Exchange 2003, Third Edition (Pro-Developer)
ISBN: 0735614644
EAN: 2147483647
Year: 2003
Pages: 227
Authors: Thomas Rizzo

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net