分享此页面

# FieldCust_AddDefect

用户定义的函数 FieldCust_AddDefect 调用函数 SetFieldApp。

该函数先将所有字段设置为不可见、非必填，以及在第 100 页的位置 0 处显示。这样可以确保在使用“项目自定义”窗口中的“项目实体”链接添加新字段时，布局不会发生更改。

在 Bug_New 事件过程中添加对 FieldCust_AddDefect 的调用，这样用户添加新缺陷时将触发它:

    Sub Bug_New
            FieldCust_AddDefect
    End Sub

首先，代码处理对所有用户组通用的字段。它只对特定用户组或针对不同用户有不同属性的用户组，为对话框中显示的字段使用条件语句。

    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
改进搜索结果的提示... ALM 帮助中心 ALM 帮助中心 ALM 帮助 17.0 全部查看本地帮助中心查看联机帮助中心后退在浏览器历史记录中后退前进在浏览器历史记录中前进删除突出显示的搜索项下一个主题转到下一个主题上一个主题转到上一个主题打印当前主题版本: