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.

VBScript example (supported in Desktop Client only)

Copy code

    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 Application Quality Management 8942
Tips to improve your search results... OpenText™ Application Quality Management Help Center OpenText™ Application Quality Management Help Center OpenText™ Application Quality Management Help 26.1 All View Local Help Center View Online Help Center Version: