Sign in to follow this  
Followers 0
BigDaddyO

COM Object .AddItem(Nothing)

6 posts in this topic

I'm trying to create an interface to allow some user to create a new Defect in Quality Center 11.

I have the script now to the point where it will log in to the specific project in Quality Center but when I try to create a new defect I get a "The requested action with this object has failed"

All of the scripts i found online say to use BugFactory.AddItem(Nothing)

I have tried "Nothing", "", Chr(0), also just omitting the () all with the same error.

Anybody have any ideas on this?

$ObjName = RegRead("HKEY_CLASSES_ROOT\TDApiOle80.TDConnection\CurVer", "")
if $ObjName = "" Then
MsgBox(270384,"QC Addin not found","Please visit this page to download the Quality Center Add-In" & @CRLF & @CRLF & "http://Bla-Bla-Bla.com:8080/qcbin/TDConnectivity_index.html")
Exit
EndIf
$HostName = "http://bla-bla-bla:8080/qcbin/"
$Domain = "Proj_Domain"
$Project = "Test"
$UserID = "test-ID"
$PassWd = "Password1"

$objOTAapi = ObjCreate($ObjName)
$objOTAapi.InitConnectionEx($HostName)
$objOTAapi.Login($UserID,$PassWd)
$LoginVal = $objOTAapi.LoggedIn
If $LoginVal <> True Then
MsgBox(0, "", "Login Failed")
Exit
EndIf
$objOTAapi.Connect($Domain, $Project)
$ProjectVal = $objOTAapi.Connected
if $ProjectVal <> True Then
MsgBox(0, "", "Failed to connect to " & $Domain & "\" & $Project)
$objOTAapi.Logout
EndIf

;~ Get bug factory
$bfact = $objOTAapi.BugFactory

;These 2 lines are just to get the count of fields to ensure properly connected to bugfactory
;~ $FieldList = $bfact.Fields
;~ MsgBox(0, "", $FieldList.Count)

;~ Add defects
$Summary = "This is a test from the External script"
$Status = "New"
$AssignTo = "admin"
$mybug = $bfact.AddItem(Chr(0)) ;<==This line is being a PITA!
$mybug.Summary = $Summary
$mybug.Status = $Status
$mybug.AssignedTo = $AssignTo
$mybug.Post

$objOTAapi.DisconnectProject()
$objOTAapi.ReleaseConnection()

It's been over a year since I have done an AutoIT script so sorry if I messed up something simple.

Thanks,

Mike

ps. the new forum setup looks cool


Share this post


Link to post
Share on other sites



See

Share this post


Link to post
Share on other sites

Zorphnog,

Thanks for the link. I tried using that and i'm still getting an error even with $Nothing. I found the better error handler _IEErrorHandlerRegister so I have more details.

No matter what I try I keep getting the same error message for that .AddItem line.

--> COM Error Encountered in QC Add a Defect.au3

----> $ErrorScriptline = 48

----> $ErrorNumberHex = 80020009

----> $ErrorNumber = -2147352567

----> $ErrorWinDescription =

----> $ErrorDescription = Parameter Type is Invalid

----> $ErrorSource =

----> $ErrorHelpFile =

----> $ErrorHelpContext = 5832762

----> $ErrorLastDllError = 0+>09:12:03 AutoIT3.exe ended.rc:0


Share this post


Link to post
Share on other sites

Use the latest beta (3.3.9.4) and try this:

$mybug = $bfact.AddItem(NULL)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Use the latest beta (3.3.9.4) and try this:

$mybug = $bfact.AddItem(NULL)

;)

That worked. THANK YOU WATER!


Share this post


Link to post
Share on other sites
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0