Validate the drop down values

Question ID: 104285
0
0

Hi,
We post a bug into our QC site through third party controls.
While posting a bug, if its value is not a valid one, its throwing up some exceptions.

For example, CreatedBy field is a dropdown in the QC site, which contains values like ‘User1’ and ‘User2’ say. And I’m trying to post a new bug into QC site which has CreatedBy value as ‘User3’ (which is not in the dropdown). And obviously, its throwing up the exception 🙂

Is there any way that I can validate the field value before posting the bug.
i.e, I want to check if ‘User3’ is present in the CreatedBy dropdown, before posting the bug.

Please advice!
Thank you!

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on November 29, 2010 10:34 pm
9 views
Answers (1)
0
Private answer

You can get the list values for any customization field with this example from the OTA guide.

Public Sub GetListsForCustomFields()
    Dim cust As Customization
    Dim custFields As CustomizationFields
    Dim aCustField As CustomizationField
    Dim custLists As CustomizationLists
    Dim aCustList As CustomizationList
    Dim ListName$, cnt%

'---------------------------------------------------
' Get the customization object and CustomizationFields.
    'tdc is the global TDConnection object.
    Set cust = tdc.Customization
    Set custFields = cust.Fields

    '
    msg = ''Active Entities for requirement table : '' & Chr(13)

'Walk through the fields of the REQ table and output
' some of the properties of the fields that are linked
' to custom lists.
    For Each aCustField In custFields.Fields(''REQ'')
        If aCustField.IsActive Then

            ListName = ''''

        'If the field is linked to a custom list, get the name
        ' of the list and the field properties.
            If Not (aCustField.List Is Nothing) Then
                cnt = cnt + 1
'-----------------------------------------
' Get the CustomizationList from
' CustomizationField.List.
                Set aCustList = aCustField.List
                ListName = _
                    '' [Values from '' & aCustList.Name & ''.]''
                msg = msg & aCustField.ColumnName _
                    & '', '' & aCustField.UserLabel _
                    & ListName & Chr(13)
            End If

        End If
    Next
    '
    msg = msg & vbCrLf & ''Count of fields with lists = '' & CStr(cnt)
    MsgBox msg

End Sub
Marked as spam
Posted by (Questions: 6, Answers: 167)
Answered on February 18, 2011 10:19 pm