Share via


Testing and Debugging in the Workflow Designer 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.

Debugging server-side script can be a challenge. Usually with Microsoft® Visual Basic® Scripting Edition (VBScript), you can use functions, such as msgbox, to determine the status of script variables during debugging. Because server script cannot display user information, you cannot take advantage of such features. To overcome this, Workflow Designer for SQL Server provides the Logger object.

The Logger object has two methods, PrintString and PrintObject, that append output to the Workflow Log (modwfe.log), which can be found in the Microsoft® Windows® directory on the server. You can use these methods to print out debugging information.

Note   Because the modwfe.log file is stored on the server, developers wanting to use the Logger object must have access to the file. The server administrator can share the file or directory to make it possible for you to access the log file. Members of the modAppOwners group do not have permissions to this file by default.

For example, the following script uses the PrintString method of the Logger object to print the value of a variable. The string is appended to the Modwfe.log file found in the Windows system directory.

dim strManager
strManager = "mymanager"
logger.printstring("The value for variable strManager is " & strManager)

To test that your workflow is functioning as you expect, you can print a string to the log whenever you trigger an event by adding code to the Code Editor such as:

Sub State1_OnEnter()
   logger.printstring("You have entered State1")
End Sub

The sample script Sending Mail Using SMTP can also be used to test that events are firing as expected.

For additional tips on debugging, visit the Microsoft® Office XP Developer Web site at http://www.microsoft.com/office/developer. Look in the Technical Resources area for articles about writing and debugging workflow script and using server-side Microsoft® ActiveX® controls and Visual Basic to debug complex scripts.

See Also

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