Using group-by fields
Sub GetGroupItems()

'Using group-by fields
    Dim aField As TDField
    Dim severityF As TDField, priorityF As TDField, statusF As TDField
    Dim fieldList As List
    Dim bFact As BugFactory
    'tdc is the global TDConnection object.
    Set bFact = tdc.BugFactory
    Set fieldList = tdc.Fields("BUG")
    For Each aField In fieldList
        Select Case aField.Name
            Case "BG_SEVERITY"
                Set severityF = aField
            Case "BG_PRIORITY"
                Set priorityF = aField
            Case "BG_STATUS"
                Set statusF = aField
        End Select
    Next aField
    Debug.Print "BG_SEVERITY can group = " + CStr(severityF.Property.IsCanGroup)
    Debug.Print "BG_PRIORITY can group = " + CStr(priorityF.Property.IsCanGroup)
    Debug.Print "BG_STATUS can group = " + CStr(statusF.Property.IsCanGroup)
'    BG_SEVERITY can group = True
'    BG_PRIORITY can group = True
'    BG_STATUS can group = True

    Dim bf As IBaseFactory2
    Set bf = tdc.BugFactory
    Dim gm As IGroupingManager
    Set gm = bf.GroupingManager
    gm.Group("BG_SEVERITY") = 1
    gm.Group("BG_PRIORITY") = 2
    gm.Group("BG_STATUS") = 3
    Dim GroupList As List
    Set GroupList = gm.GroupList
    Dim Group As GroupingItem
' GroupList is a list of groups at the first level
' under the one in which it was created.
    For Each Group In GroupList
        Debug.Print "Name: " + Group.FieldName + " Value: " + Group.FieldValue
'        Name: BG_SEVERITY Value: 1-Low
'        Name: BG_SEVERITY Value: 2-Medium
'        Name: BG_SEVERITY Value: 3-High
'        Name: BG_SEVERITY Value: 4-Very High
'        Name: BG_SEVERITY Value: 5-Urgent


    Dim itm As Bug, cnt As Integer
' ItemList is a list of the objects
' included in the group.
    For Each itm In gm.ItemList
      With itm
      Debug.Print .ID, .Field("BG_SEVERITY"), .Field("BG_PRIORITY"), .Field("BG_STATUS")
      End With
    Set Group = GroupList.Item(1)
    Debug.Print "Name: " + Group.FieldName + " Value: " + Group.FieldValue
    'Name: BG_SEVERITY Value: 1-Low
    Dim oList As List
    Set oList = Group.GroupList
    Dim sg As GroupingItem
    For Each sg In oList
        Debug.Print "Name: " + sg.FieldName + " Value: " + sg.FieldValue
'        Name: BG_PRIORITY Value: 1-Low
'        Name: BG_PRIORITY Value: 2-Medium
Exit Sub
' Handle errors
End Sub