junkew Trusted Contributor.
Trusted Contributor.

HP ALM 12 workflow script testplan get selected test / selected folder

How can I determine in workflow script on testplan if I have selected

a. one item

b. multiple items

c. determine for each item selected the type (folder or test or ....)

Below works for 1 test selected (and offcource based on that with OTA I can get TSTest etc) but when 1 folder is selected it gives me still the information on last selected test (which then is not selected as I have folder selected)

Within workflow script when I add a toolbar button on testplan (that part works fine)

Function ActionCanExecute(ActionName)
          If ActionName="UserDefinedActions.TestPlan_ShowInfo" then
              'Dispatch to procedure to keep this actioncanexecute clean
         end if
end function
sub TestPlan_Defaultexport()
'Actions Object
'Action Object
'Fields Objects
'Field Object
'Lists Object
'TDConnection Object
'User Object
'ActiveTreeSelection Object

         msgbox Test_Fields("TS_TEST_ID").Value

end sub


1 Reply
Knowledge Partner
Knowledge Partner

Re: HP ALM 12 workflow script testplan get selected test / selected folder

Add this in Test_MoveTo:

Set currentTest = TDConnection.TestFactory.Item(Test_Fields.Field("TS_TEST_ID").Value)
Set currentSubject = Nothing

And in TestFolder_MoveTo:

    Set currentTest = Nothing
    Set currentSubject = tdc.TreeManager.NodeById(TestFolder_Fields("AL_ITEM_ID").Value)

Now you can make tests like If currentSubject Is Nothing Then... to see which type of object is selected.


There is currently no straightforward way of detecting if multiple objects are selected - MoveTo will only care about the last item selected.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
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.