preload

List Items with Cascading Dependencies (HP ALM/QC)

Posted by Albert Gareev on May 15, 2015 | Categories: HP ALM / QCSource code

This is a technical entry with my research-and-experiment notes. Feel free to add or argue. Try at your own risk.

I continue my study journal figuring out HP ALM configuration. This is a second entry about customization with VBScript.

General Idea

Typical issue / defect management workflow is based on rules specific to the Role and State. For example, Developer may set issue state to Fixed, but cannot set it to Verified, while it’s vice versa for Tester. HP ALM has a built-in option for 2-step dependencies (mentioned here). For more complex rules administrators need to use VBScript for real-time customization.

Note that there are two particular challenges:

  • As transition rules are different for different Roles, contents of dropdowns must change dynamically. You’ll need to have different Project Lists to be pre-defined.
  • Setting lists’ options and list items should be done on the fly and support reverse of selection before changes have been submitted. I.e. when the user changes status from Open to Closed she gets one set of lists’ options, but she should be able to change it back or to something else, while staying in the same window. For that purpose, an extra field could be used to store a ‘base’ status.

Code Examples

Storing Status

Sub Template_Bug_MoveTo
On Error Resume Next
  Template_WizardFieldCust_Details ' Added by wizard

  'store BaseResolution
  Bug_Fields("BG_USER_TEMPLATE_19").Value = Bug_Fields("BG_USER_TEMPLATE_14").Value

  'store BaseStatus
  Bug_Fields("BG_USER_TEMPLATE_18").Value = Bug_Fields("BG_STATUS").Value
'...
End Sub

Conditional Rules

Sub Template_Bug_FieldChange(FieldName)
'...
On Error Resume Next

  'special setup for Test group
  If User.IsInGroup("Testers") Then

    'Status
    If FieldName= "BG_STATUS" then

      'Closed
      If Bug_Fields("BG_STATUS").Value = "Closed" Then
         If Bug_Fields("BG_USER_TEMPLATE_18").Value = "Open" Then
              'Resolution
              Bug_Fields("BG_USER_TEMPLATE_14").Value = "Revisit In Future"
              Bug_Fields("BG_USER_TEMPLATE_14").List = Lists("lstResolution_Closed1")
         End If
         If Bug_Fields("BG_USER_TEMPLATE_18").Value = "Verified" Then
              'Resolution
              Bug_Fields("BG_USER_TEMPLATE_14").Value = "Passed"
              Bug_Fields("BG_USER_TEMPLATE_14").List = Lists("lstResolution_Passed")
         End If
         If Bug_Fields("BG_USER_TEMPLATE_18").Value = "Reopen" Then
              'Resolution
              Bug_Fields("BG_USER_TEMPLATE_14").Value = "Revisit In Future"
              Bug_Fields("BG_USER_TEMPLATE_14").List = Lists("lstResolution_Closed1")
         End If
      End If

      'Reopen
      If Bug_Fields("BG_STATUS").Value = "Reopen" Then
         If Bug_Fields("BG_USER_TEMPLATE_18").Value = "Closed" Then
              'Resolution
               Bug_Fields("BG_USER_TEMPLATE_14").Value = "To Be Reviewed"
               Bug_Fields("BG_USER_TEMPLATE_14").List = Lists("lstResolution_TBR")
         End If
         If Bug_Fields("BG_USER_TEMPLATE_18").Value = "Ready For Testing" Then
              'Resolution
              Bug_Fields("BG_USER_TEMPLATE_14").Value = "Failed"
              Bug_Fields("BG_USER_TEMPLATE_14").List = Lists("lstResolution_Failed")
         End If
      End If
'...
  End If
'...
End Sub

  • 2 responses to "List Items with Cascading Dependencies (HP ALM/QC)"

  • Kim Smith
    26th August 2016 at 12:32

    We have fields which are assigned project lists based on the value chosen for another field. I am often asked if I can force the value into a field if the list assigned only contains one item. I can assign a value to a field in workflow scripting, and I can access the name of the list assigned to a field, but I have not been able to figure out how to pull the list item out of a list in workflow scripting.

    I have tried the code below. The first mgsbox shows the name of the list correctly. The other two do not execute. I have tried with both an index of 0 and of 1.

    msgbox “listname = ” & Bug_Fields(“BG_USER_TEMPLATE_05”).List.name

    msgbox “item = ” & Bug_Fields(“BG_USER_TEMPLATE_05”).List.RootNode.Children.Item(0).Name

    msgbox “item = ” & Bug_Fields(“BG_USER_TEMPLATE_05”).List.rootnode.item(0)

    I am able to extract list items using OTA API in external scripts, but I can’t seem to figure out the syntax for internal workflow scripting.

  • Leave a Reply

    * Required
    ** Your Email is never shared

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.