Share this page

# Example: Changing a Field Based on the User Group

This example demonstrates how you can change a field value according to the user group of the user entering the defect.

In this example, the user-defined field BG_USER_01 is a detection mode field in which the user who detected the defect can enter the way in which it was discovered. Possible values are `Formal testing, Informal testing,` and`BTW`.

The example sets the value of the detection mode field to `BTW` when a defect is opened by a user who is not in the `QA Tester` group. If the defect is opened by a user who is in the `QA Tester` group, the default value `Formal testing` is set.

Add the code to event procedure `Bug_New`, so that it is triggered when a defect is added.

    Sub Bug_New
            On Error Resume Next
            If not User.IsInGroup("QATester") then
                Bug_Fields("BG_USER_01").Value = "BTW"
            Else
                Bug_Fields("BG_USER_01").Value = "Formal testing"
            End If
            PrintError "Bug_New"
            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: