QC workflow code alrtable not working

  • Questions
  • QC workflow code alrtable not working
Question ID: 105494
0
0

In ALM, I’m trying to programmatically alert a defect when the status changes to fixed. My code is in the Bug_FieldChange() handler. When the code runs, I get a "Project is not connected." message on the line where the alert gets set. I tried explicitly setting the connection (commented out) with the same result. The series of msgbox’s prove that the project is indeed connected. So why am I getting this error message (below)? Code is below that. BTW, this issue exists in ALM 11.52 and ALM 12.

![alt text][1]
[1]: /storage/temp/192-2014-07-14_7-01-54.png

Sub Bug_FieldChange(FieldName)
On Error Resume Next

if FieldName = "BG_USER_03" then
if Bug_Fields("BG_USER_03").Value = "Fixed" then
Bug_Fields("BG_STATUS").Value = "Fixed"

bgId = Bug_Fields("BG_BUG_ID").Value

Set tdc = TDConnection
‘tdc.InitConnectionEx "http://MyServer/qcbin"
‘tdc.Login "MyUser", ""
‘tdc.Connect "DEFAULT", "MyProj"

msgbox tdc.LoggedIn
msgbox tdc.Connected
msgbox tdc.ServerName
msgbox tdc.ProjectName
msgbox tdc.ProjectConnected

Set bgFact = tdc.BugFactory
Set bg = bgFact.Item(bgId)
Set Alrtable = bg

‘ Set the alert
Set Alrt = Alrtable.AddAlert("DEFECT", BgId, "Status Changed", "Status: Fixed")

end if
end if

On Error GoTo 0
End Sub

Marked as spam
Posted by (Questions: 25, Answers: 12)
Asked on July 14, 2014 12:14 pm
17 views
Answers (1)
0
Private answer

@CandyB you don't need all that connection stuff in the workflow you already have context. Just do something like this. You also need the correct entity name in the AddAlert method ''BUG'' not ''DEFECT''.

if FieldName = ''BG_USER_06'' then
if Bug_Fields(''BG_USER_06'').Value = ''Fixed'' then
Bug_Fields(''BG_STATUS'').Value = ''Fixed''

bgId = Bug_Fields(''BG_BUG_ID'').Value
Set bgFact = TDConnection.BugFactory
Set bgobj = bgFact.Item(bgId)

Set Alrtable=bgObj

Set Alrt=Alrtable.AddAlert(''BUG'', bgId, ''Status Changed'', ''Status: Fixed'')

end if
end if

Marked as spam
Posted by (Questions: 6, Answers: 167)
Answered on May 1, 2015 1:09 pm