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 for SQL Server

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.

When using an 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 automatically, you must find the manager's e-mail address. The following code examples are available for use:

In each example, "Calling the Function" provides the script required to call the function. Place this code in the Code Editor in a validation or event script procedure for the event that you want to trigger the script. For example, if you want to call a function that executes when a record exits a state named State1, double-click the OnExit icon on State1 to open the Code Editor with the appropriate Sub/End Sub tags added, and enter the "Calling the Function" code between the tags:

Sub State1_OnExit()
End Sub

"Example Script" provides the code that should be entered into the Code Editor wherever you usually store functions.

To see additional workflow script examples, create an instance of the Issue Tracking sample template. The workflow process in the Issue Tracking sample contains many helpful script examples.

See Also

Scripting Workflow Events | Scripting in the Workflow Designer for SQL Server | When to Use Which Event | Data Manipulation Using Workflow Script | Debugging Script in the Workflow Designer for SQL Server