Sending Mail when a Defect is Submitted
This example sends mail when a defect is submitted.
Add a call to the SendDefect
procedure in the Bug_AfterPost
event procedure.
Note: If the SendDefect
procedure is called before the defect is submitted, the values that were changed in the current modification will not be included. The database is updated with the new values only after the defect is posted.
Sub SendDefect (iObjectId, strTo, strCc, strSubject, strComment) On Error Resume Next Dim objBugFactory, objBug Set objBugFactory = TDConnection.BugFactory Set objBug = objBugFactory.Item(iObjectId) objBug.Mail strTo, strCc, 2, strSubject, strComment Set objBug = Nothing Set objBugFactory = Nothing PrintError "SendDefect" On Error GoTo 0 End Sub
The constant 2
in the call to objBug.Mail
indicates that the history should be included with the mail. For a list of the constants that can be used to customize email, refer to the tagTDMAIL_FLAGS
enumeration in the ALM Open Test Architecture API Reference. In workflow scripts, use numeric constants and not the enumeration values.