Add a user defined field
Public Sub AddUDF()
' Add a user defined field

    Dim cFields As CustomizationFields
    Dim cField As CustomizationField
    Dim custom As Customization
    
    'Get an unused field for a defect.
    Set custom = tdc.Customization
    Set cFields = custom.Fields
    Set cField = cFields.AddActiveField("BUG")
        
    ' The name.
    cField.UserLabel = "Delay Reason"
    ' To use a list of values, make the field a tree node.
    cField.Type = tagTDAPI_DATATYPES.TDOLE_TREENODE
    ' Enforce using only values from the list.
    cField.IsVerify = True
    ' Make it a required field.
    cField.IsRequired = True
    
    ' Attach the field to the custom list.
    Dim oLists As CustomizationLists
    Dim oList As CustomizationList
    Set oLists = custom.Lists
    Set oList = oLists.List("Delay_Reasons")
    cField.List = oList
    cField.Updated = True
    custom.Commit
End Sub