How to use defect email workflow to email defect to a group?
Question ID: 104855
1
0

Currently we have automail set up in QC, however there are certain conditions that we sometimes need an email to be sent to a user(other than the assigned to or detected by users), or a particular group when the status of a defect changes . Is there a way to do this through defect workflow?

Marked as spam
Posted by (Questions: 100, Answers: 5)
Asked on February 15, 2013 3:20 pm
159 views
Answers (1)
2
Private answer

See below for an example of how to create a workflow to send defect email based on a status change. In the below example if the defect status is changed to ''Development'' then an email is sent to all users in the user group ''TDAdmin'' and another email address ''fake@email.com'' is copied on the message. In the below example a new sub routine would need to be created called ''SendDefectMail'' this would be placed in the defect workflow outside of the other sub routines. Then this sub is called in the already existing Bug_AfterPost.

Note: This is just an example, this code will need to be modified to fit your specific needs. I would suggest to implement this in a test project and test before implementing in production.

Where the code goes will really depend on what set of circumstances that you want the email to be triggered under. In the example I placed the code into the Bug After Post section because I wanted the event to be triggered when a defect is modified and saved and meets certain criteria.

Another place that the code could be placed is in the Bug field change(this would send the email as soon as the field is changed to a certain value even if the defect is not saved).

It could also be put into bug new(then it would only send the email if the condition is met and it is a new defect being created, if the field was changed on an existing defect then it would not be sent).

Sub SendDefectMail (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

Sub Bug_AfterPost
On Error Resume Next

If bug_fields(''BG_Status'').value = ''Development'' Then
strSubject = ''Defect Change Notification'' & _
'' for project: '' & TDConnection.ProjectName & _
'' in domain: '' & TDConnection.DomainName

strComment = ''The status of this defect has been changed to Development''

SendDefectMail Bug_Fields(''BG_BUG_ID'').Value, _
''[TDAdmin]'', ''fake@email.com'', _
strSubject, StrComment

End If
On Error GoTo 0
End Sub

Marked as spam
Posted by (Questions: 0, Answers: 364)
Answered on February 15, 2013 3:27 pm
0
This worked well, I am now able to email whole QC groups on defects when certain conditions are met. Thanks
( at February 25, 2013 2:07 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top