The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Script Examples

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The following examples are available for use in your workflow scripting:

  1. Finding a User's E-mail Address in the User Directory

  2. Sending Mail using SMTP

  3. Finding a Manager in the User Directory

  4. Sending Mail to a Manager

  5. Calling a Stored Procedure

Many of the functions in these examples refer to and rely on each other. When using the example script, be sure to verify that all parameters and dependent functions exist in the workflow script. For example, before you can send e-mail to a user's manager, you must find the manager's e-mail address.

In each example, the "Calling the Function" section provides the script required to call the function. Place this code in the Shared Script tab for a validation or action script procedure for a particular action. Action procedures are only executed if the associated validation script procedure returns True. For example, the following function call should be added to the action code:

Sub State1_OnUpdate()
End Sub

The "Example Script" section provides the code for the function that should be placed at the beginning or end of the text in the Shared Script tab, which is located in the Workflow Process pane of a particular workflow process. For example, the following script should be added to the beginning or end of the text in the Shared Script tab:

Function Function_Name_Here
        Dim Var1
        Var1 = 123

        If Var1 = 123 then
           Function_Name_Here = False
           Function_Name_Here = True
        End If
End Function

For details about adding script to your solution, see Scripting Workflow Actions.

To see additional workflow script examples, create a team solution based on the Issue Tracking template. For details, see Creating a Team Solution Based on a Team Template. The workflow process in the Issue Tracking solution contains many helpful script examples.

For additional samples, visit the Microsoft Office Developer Web site at