The following examples are available for use in your workflow scripting:
- Finding a User's E-mail Address in the User Directory
- Sending Mail using SMTP
- Finding a Manager in the User Directory
- Sending Mail to a Manager
- 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() Function_Name_Here 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 Else 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 http://msdn.Microsoft.com/Officedev.