Share this page

# FieldCust_AddDefect

The user-defined function FieldCust_AddDefect calls the function SetFieldApp.

The function first sets all fields to be invisible, not required, and to appear on page 100 at location 0. This ensures that if you add a new field using the Project Entities link on the Project Customization window, the layout will not be changed.

Add a call to FieldCust_AddDefect in the Bug_New event procedure so that it will be triggered when a user adds a new defect:

    Sub Bug_New
            FieldCust_AddDefect
    End Sub

First, the code handles the fields that are common to all user groups. It uses conditional statements for the fields that will appear in the dialog box only for specific user groups, or that will have different properties for different users.

    Sub FieldCust_AddDefect
            On Error Resume Next
    	 ' Initialize the fields of the defect
            For i= 0 To Bug_Fields.Count -1
                SetFieldApp Bug_Fields.FieldByID(i).FieldName, _
    	     False, False, 100, 0
            Next
            ViewNum = 0
            PageNum = 0
        	' Set fields that are in common for all user groups
            SetFieldApp "BG_BUG_ID", True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_DESCRIPTION", True, False, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_SUMMARY", True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_DETECTED_BY", True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_DETECTION_DATE", _
    	 True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_DETECTION_VERSION", True, True, PageNum, _
            ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_SEVERITY", True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_PRIORITY", True, True, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_PROJECT", True, False, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_REPRODUCIBLE", True, False, PageNum, ViewNum
            ViewNum = ViewNum + 1
            SetFieldApp "BG_STATUS", True, False, PageNum, ViewNum
            ViewNum = ViewNum + 1
    	 ' Set fields that are different for different user groups.
    	 ' Since one user can belong to multiple user groups,
    	 ' or none of these groups, there is no need for an Else statement.
            If User.IsInGroup("Developer") Then
                SetFieldApp "BG_PLANNED_CLOSING_VERSION", True, False, _
                PageNum, ViewNum
                ViewNum = ViewNum + 1
                SetFieldApp "BG_PLANNED_FIX_TIME", True, False, PageNum, _
                ViewNum
                ViewNum = ViewNum + 1
            End If

            If User.IsInGroup("QATester") Then
                PageNum = PageNum + 1
                SetFieldApp "BG_USER_01", True, False, PageNum, ViewNum
                ViewNum = ViewNum + 1
                SetFieldApp "BG_USER_02", True, False, PageNum, ViewNum
                ViewNum = ViewNum + 1
            End If

            SetFieldApp "BG_ACTUAL_FIX_TIME", True, False, PageNum, _
            ViewNum
            ViewNum = ViewNum + 1
    	 ' ...
            PrintError "FieldCust_AddDefect"
            On Error GoTo 0
    End Sub

https://admhelp.microfocus.com ALM 8942
Tips to improve your search results... ALM Help Center ALM Help Center ALM Help 15.5-15.5.1 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: