Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class
9009 views

Creating new Alert Rules

I need to figure out a way to create new Alert Rules besides the four already created in Project Customization > Alert Rules. I would like for an alert to be created whenever a defect's status changes, instead of an alert being created only when a status changes to "Fixed."

I'm sure this can be done in the Bug_FieldChange function, but I haven't found how to create an alert.

Thanks in advance
0 Likes
13 Replies
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

^bump
0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Can anyone help me out on this?

Thanks,
Jacob
0 Likes
Absent Member.
Absent Member.

I'd like to know as well.
I haven't found a way yet.
Create a support ticket with HP and let us know what they say.
0 Likes
Absent Member.. Absent Member..
Absent Member..

Hi!

I found that script some time ago in the knowledge base.... You have to modify it for the Defect Module but it should not be so difficult.

Best regards.



Solution
Modify the code in the Workflow to send an e-mail when requirement fields are changed

You will need to add code to the TestDirector/Quality Center WorkFlow in order to send an e-mail to a specific user or group.

1. Launch TestDirector/Quality Center.
2. Select "Customize."
3. Select "Set Up Workflow."
4. In the Set Up Workflow window, select "Script Editor."
5. Select Workflow Scripts -> Requirements module script script -> Requirements_Req_FieldChange.
6. Add the required code to this subroutine.

Example:
The code below will send an e-mail to the TDAdmin group whenever the status field is changed.

Sub Requirements_Req_FieldChange(FieldName)
On Error Resume Next
if FieldName= "RQ_REQ_STATUS" then
set rs = TDConnection.ReqFactory
set rst = rs.Item(Req_Fields.Field("RQ_REQ_ID").Value)
rst.Mail "[TDAdmin]", "", 0, "The Requirement " & rst.name & " Status Changed"
end if
On Error GoTo 0
End Sub
0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Thanks boris79, but I'm not looking to send mail when a field changes. Instead, I'm looking for a way to create an alert (the red exclamation mark to the left of a defect/test/req etc.) when a Defect's Status is changed.

One of the four alert rules creates an alert when a Defect's Status changes to 'Fixed', but in my case the 'Fixed' field is not used. I would like to create an alert rule that creates an alert whenever a Defect's status is changed.
0 Likes
Absent Member.. Absent Member..
Absent Member..

Sorry, was a misunderstanding

The functions should look like:

Sub Bug_FieldChange(FieldName)
On Error Resume Next
if FieldName= "RQ_REQ_STATUS" and Bug_Fields("RQ_REQ_STATUS).Value = "Fixed" then
Bug_Fields("USER_XX").isRequired = true 'creates the red asterix near the field
end if
On Error GoTo 0
End Sub
0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

boris79,

I am either completely misinterpreting your last post or either you may be misunderstanding what an Alert in QC is.

By default there are four 'Alert Rules' found in 'Customization'

1) When a requirement is modified, alert the associated tests.
2) When a defect status changes to 'Fixed, alert the associated test instances.
3) When a test runs successfully, alert the linked defects.
4) When a requirement is modified or deleted, alert traced to requirments and child requirements.

For example: If an alert is created when a test runs successfully, a red exclamation mark will appear in the left portion of the Defects Grid. This exclamation point is the alert tied to the test and defect. It alerts users that the test associated with that defect has been successfully ran.

Your function is making "USER_XX" Required (putting a red asterix near the field) when Status changes to fixed. That does not have anything to do with Alerts.

I hope this helps clear up any confusion.

Thanks

0 Likes
Absent Member.
Absent Member.

Hi,

I'm working on the same thing. I was able to generate an alert when a value is changed in a bug field. But I'm stuck at a point where I need to get all the entities linked to a defect and generating the alert to all the linked entities.

Here is the code which I used to generate an alert.

 

 

Sub Bug_FieldChange(FieldName)
  On Error Resume Next

If FieldName = "BG_USER_01" then
    ' Connect to BugFactory
    Set BugF = TDConnection.BugFactory
    Set BugList = BugF.NewList("")
    Set Bug = BugList(Bug_Fields.Field("BG_BUG_ID").value)
    bID = Bug.ID
    ' Cast the Bug object to IAlertable2.
    Set IAlertable2 = Bug
    'Create the alert.
    Set Alert = IAlertable2.AddAlert("BUG", bID, "Testing The TestCase - Bug Alert", "Description")
End if

 On Error GoTo 0
End Sub

 

Thanks in Advance! Please help.

 

 

0 Likes
Absent Member.. Absent Member..
Absent Member..


@RCMTester wrote:

Hi,

I'm working on the same thing. I was able to generate an alert when a value is changed in a bug field. But I'm stuck at a point where I need to get all the entities linked to a defect and generating the alert to all the linked entities.

Here is the code which I used to generate an alert.

 

 

Sub Bug_FieldChange(FieldName)
  On Error Resume Next

If FieldName = "BG_USER_01" then
    ' Connect to BugFactory
    Set BugF = TDConnection.BugFactory
    Set BugList = BugF.NewList("")
    Set Bug = BugList(Bug_Fields.Field("BG_BUG_ID").value)
    bID = Bug.ID
    ' Cast the Bug object to IAlertable2.
    Set IAlertable2 = Bug
    'Create the alert.
    Set Alert = IAlertable2.AddAlert("BUG", bID, "Testing The TestCase - Bug Alert", "Description")
End if

 On Error GoTo 0
End Sub

 

Thanks in Advance! Please help.

 

 



How can the Alert be Closed by any user?

 

The Alerts are created but Assigned to the User Who created it. No other users can close it.

 

I'd think the function should create as no user name, whereby the Alert should be able to be actioned by any user.

 

Any ideas how to make it an Alert for all users?

0 Likes
Absent Member.. Absent Member..
Absent Member..

I would like to ask if anyone can help me how to add in an alert rule whenever the following items happen on a defect:

 

Open --> Fix - alert a certain user group

Fixed --> Verified as fixed - alert a certain user group.

 

 

Thanks.

0 Likes
Absent Member.. Absent Member..
Absent Member..

Dessa_sw,

I think Alert and Notification are once again being confused. If you are wanting to Notify (via email) a specific group of users then please open a new thread (instead of reopening one from over a year ago)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.