|
Bring order to the workplace
Continued from page: 1
Wednesday, February 22, 2006
Implementing Workflow in Exchange
2000
We setup a simple leave application process on the server, design
the complete process, and automate the same
Exchange is one of the most popular messaging platforms,
but that's not the only function it can achieve. You can also configure
Exchange to automate small business processes in you office. It has an
entry-level built-in workflow system, which can be leveraged for automating
simple processes. Designing the whole workflow system, however, is a bit
complicated and would require both Exchange administration and some VB skills.
Here, we'll demonstrate how to configure a workflow system for a leave
application process. In this process, a user files a leave application in a
pre-defined mail form in the workflow system. Then, coding in the workflow
system processes the mail and fetches the required data from the mail form and
forwards it with a new mail form to the concerned authority for approval. If the
leave gets approved, it's forwarded to the personnel department and a
notification is sent to the user thereafter about his/her leave application
status. The entire workflow implementation is divided into two parts, server
side and client side. The former requires Exchange administration, while the
latter requires VB skills.
 |
| Configure the component service and set the roles for 'Can Register Workflow' and 'Privileged Workflow Authors' |
On the server side
Here, you need either a Windows 2000 or a Windows 2003 server with
Active directory, and a MS-Exchange 2000 server fully configured and running. We
used a Windows 2003 server for the job. To configure the workflow on Exchange,
you need to first create a username 'Workflow System', open this user's
properties and add it to the Exchange domain server group. Next, configure a
workflow engine on the Windows domain from Start>Programs>Administrative
tools>Component Service. Here, select Component Services>MyComputer>COM+Applications>
WorkflowEvent.Sink>Roles. You will get two components-'Can Register
Workflow' and 'Privileged Workflow Authors'. In both , add the user that
you just created by right clicking the user icon and selecting 'New' from
the context menu. After this, select the components folder under 'Workflow
Event.Sink' and select 'CdoWfEvt.EventSink.1' and then open its property
by right-clicking on it. On the property sheet, click on the Security tab and
check 'Enforce Component Level Access Check' and in 'Roles Explicitly Set
by Selected Item', check both 'Can register Workflow' and 'Privileged
Workflow Authors Object' and click on Apply.
After this you have to create a public folder, where you
will host your entire workflow system. To do this, start Microsoft Outlook and,
on the View menu, select Folder List. Then expand the public folders node and
then expand All Public Folders. Here right-click 'All Public Folders' and
select New Folder. Give the name for the new folder, such as Leave. This folder
will be used by your Exchange Workflow Engine.
On the client side
 |
| A sample workflow design using Exchange Workflow Designer for automating a leave approval process in an organization |
On the client side, you need MS-Outlook and Workflow Designer for
Exchange tool. We've given it on this month's PCQuestXtreme CD. The first
thing you need to do after installing it is to create a user interface, which is
basically an Outlook form for the user to fill in the leave application. To
create the user interface, open MS Outlook client and click Tools>
Forms>Design a Form. This will open a window asking to choose the type of
form you want to design. Select 'Post' from the list and click on OK. Now
you will get a design form on your MS Outlook screen. Here, from the tool bar
you will see two buttons 'Edit Compose Page' and 'Edit Read Page view' button. 'Edit Compose Page
View' is used by the person submitting the leave form to input data into the
leave fields. It appears when the leave application is created or composed. You
are shown this view automatically when you are designing a form. The text boxes
on the form provide values to the script used in the workflow. The 'Edit Read
Page View' is used by a manager to approve or reject the leave. It contains an
approval and rejection combo box in addition to the leave text box.
Creating Edit Compose Page View
Open the Outlook mail client and open the public folder that you have
created in the server configuration section. This folder will be used by the
workflow system. Then open a design form as mentioned above and click 'Edit
Compose Page' button from the tool bar and design the form according to your
needs. For example, for the leave form application, resize the message area to
create space for the Leave form fields. On the form right-click and click on
Control Toolbox, then add the following labels
Controls Properties
Number
(label) Caption: leaves
Next, add the following controls to the form to enter and
display the leave values (number of leaves that one needs to avail). To modify
the associated properties of the controls, right-click the control and then
click on 'Properties'. On the Value tab, click on the 'New' button to
specify a user-defined field that the workflow script can use as a reference.
Controls Properties
Leave textbox
Name: No_leave
Type: Number
Submit checkbox
Name: Submit
Type: Yes/No
Format: True/False
On the submit property sheet, Check 'Set the initial
value to this field' and set 'No' as the default value.
Creating Edit Read Page View
In order to create the Edit Read Page view of the Outlook form, Go to
Edit Compose Page view of the form, select and copy all of the controls you
added to the form. Then click Edit Read Page and resize the message area to
create space for the controls, and then paste them in place. Arrange the pasted
controls according to your need and add a combo box control to the form. Then
right-click the combo box control and click on 'Properties'. Click 'New to
set a user-defined field and set the properties shown in the following
Property Value
Name
Approved
Type
Yes/No
Format
Yes/No
List type
Dropdown
Possible values
Yes;No
Initial value
No
Once you have finalized both forms, you need to publish
them to the public folder and make them available for your workflow system. Do
this by going to the Tools> Forms in Outlook and select 'Publish Form
As'. Here, specify the form name and click on Publish.
Note: The name you provide is the name that the users see
when they choose a form to post in the workflow public folder. We've called it
'Leave Application Form'.
Go to the folder list and right-click on the folder you
want to add the workflow in, and click on Properties. Then in the 'When
posting to this folder use' selection box, select the form you published above
(Leave Application), and then click on OK. With this, your form design part is
over. Next comes the coding to make the process work. Before that, the developer
has to plan how the workflow of a particular process needs to be automated by
drawing a workflow process on a piece of paper. In this, the developer needs to
visualize where to add code that will extract data from the mail forms and
process it and then decide where to send the processed data. Once you're ready
with the plan, use Microsoft Workflow Designer for Exchange to design you
workflow process. In our case there were only three elements in the workflow
design-Draft, Submit to manager, and Approved.

Launch Workflow Designer from Program Files>Workflow
Designer for Exchange>Exchange Workflow Designer. On its interface, go to
File>New Workflow Project. Give your project a name and enter your Exchange
Server's name or IP address and public folder location for leave applications
in the location text box. This would be of the format
http://Your-Exchange-Server's-IP/Public/leave application. Click on OK and
you'll be asked to provide a username and password. Give the credentials you
created for this folder in the server setup section. After authentication, you
will get a design window where you have to draw the diagram of your workflow
system. Here, go to the diagram menu, click on Arrange Diagram, and then click
on Vertical. Then right-click the design window and click on Zoom and then click
on 'Zoom to Fit'. Initially, in the diagram window, you will see Item
Created and Delete object. You have to design the process between these two
states.
Adding States to the workflow
diagram
States are the various stages of your workflow processes. You can add
states to the workflow diagram representing each stage through which an item
might pass during processing. In our example, the states used in the leave
application workflow diagram are: Draft, Submit to Manager, and Approved. You
can drag and drop these state objects form the tool bar. Create the states
according to the diagram of the leave process in this article.
Adding Transition actions to
States
Transition is basically a line connecting the states. This is where
you have to add code for actions like Submit or Reject. These establish
relationships between the states in the workflow and also provide a place to add
the script for automating the workflow. In addition, workflow actions can be
used to evaluate conditions and to trigger scripts that automate your workflow
process. To add an action, just select the Transition actions from the tool bar
and draw a transition between the states that you have created from your
process. Let's see how you can add code to the transition using this leave
application example.
You can divide the code in two segments-Shared script
procedure and user-defined script. A Shared script procedure is created on the
Shared Script tab in the Workflow Designer. Scripts in the shared script tab are
common library of script routines. These procedures are used frequently in all
states. When you plan to use a procedure or function in your workflow process,
you create it once on the Shared Script tab and then call it from the Condition
Expression text box and from the Action Script Procedure text box.
This condition expression is the first script, accessed by
the workflow engine in response to a given workflow action. By default, the
condition expression returns a value of True. You can modify this value by
typing 'False' in the Condition Expression scripting box, creating an
expression, or calling a function from the Shared Script tab to perform the
task. User-defined scripts are written by the developer to perform certain tasks
in the workflow. To create a procedure or function on the Shared Script tab,
click Process List, and select the workflow process that you are working on.
Then in the Workflow Process pane, select the Shared Script tab. Here create
procedure, including Sub and End Sub tag.
To complete
the leave application example, we have added the action conditions, and script
specified in the following procedure. This script calls user-defined functions
specified in creating the Shared Script procedures. On the diagram, select the
Submit to Manager State, and add the transition. Instructions for setting the
transition properties can be accessed at http://forums.pcquest.com
under the current issue.
The procedures used in this example rely on each other.
When using the example script, be sure to verify that all parameters and
dependent functions exist in the workflow script.
Script such as Submitleave and Approveleave are
user-defined functions which is used to submit leave applications to the manager
and then the other script deals with accepting or rejecting the leave. You'll
find the code for these also on the PCQuest online forum.
Activating the workflow
Once you're done with the coding, you have to activate the code in
the workflow system. For this, go to properties of the leave application project
and select the Default workflow property. Select the process list that you want
to add in this workflow folder. Then on the same property sheet, set
workflowEnable=True. This will activate the code written in the designer to the
exchange workflow engine.
Using the workflow process
Now a user in the organization can file his leave application from
their Outlook client itself. The leave folder from the Exchange Public folders
will automatically appear on every user's system. Go to this folder and click
New to display the leave Application form. Enter the reason for leave in the
subject field. Fill in the number of days for which you'd like to have leave
and check the submit check box for your manager's approval. An e-mail message
will be sent by the workflow system to your manager. When the manager opens the
mail, then he'll just have to accept or reject the leave. In both cases, the
notification will be sent to you by the workflow system. Page(s) 1 2 3 4
|