Customize Assigned To user.

I'm tasked to customize the Assigned To user list to display only user that are relevent to current logged in user group.


Here is the group and user structure :


Group Name : "TestManager"

Users :

1. testmanager1

2. testmanager2

3. sha.testmanager3


Group Name : "Tester"

Users :

1. tester1

2. user1.tester


Scenario and Rules:

username tester1 is in a group called "Tester". User in this group can only assign new defect to user in group "TestManager". So the question is how to filter the user list in Assigned To or BG_RESPONSIBLE field to only show user that are relevent to current logged in user group.

  • You cannot segregate/Split/Filter the user list in the "Assigned to"  field, & you can make visible thefield to only particuar user group through workflow script editor, refer the Admin guide, it explains a lot in detail to an extent of use...!!

  • You can't filter the user list the way you want. Two ways to accomplish your goal:


    1. Add code to Bug_FieldCanChange that evaluates the choice made by the user. If an invalid option is selected you return False, which resets the field to the original value. You can display a message to the user that explains which options are allowed.
    2. Create a new field of type Lookup list. Create two lookup lists with the relevant user names on each. You can let this field update the Assigned To field from the workflow Bug_FieldChange procedure. For the new field you can switch the user list associated with the field at login, based on the user group membership. The tricky thing here might be to keep the lists updated when the members of your groups change. You might automate this to some extent, but if the user groups are fairly stable you could do it manually.
  • By studying the Sample ALM Defect Customization, I get an idea of synchronizing BG_RESPONSIBLE with BG_USER_01 (Lookup List).


    I then create a function to list username based on group (obtained the US_GROUP in ALM Site Admin, in Database tab and then crossmatch with username accordance to groups set in ALM).


    Function RetrieveUserInGroup()
    On Error Resume Next
    dim com 'As Command
    dim rec 'As RecordSet
    set com = TDConnection.Command
    If User.IsInGroup("Tester") Then
    SQL = "select US_USERNAME from USERS where US_GROUP='00001100'"
    Else If User.IsInGroup("TestManager") Then
    SQL = "select US_USERNAME from USERS where US_GROUP='00001100' And US_GROUP='00001010' And US_GROUP='00001001'"
    End If
    End If
    com.CommandText = SQL
    set rec = com.Execute
    For Each row In rec.Rows
    RetrieveUserInGroup = row
    set rec = nothing
    set com = nothing
    On Error GoTo 0
    End Function

    Then I put this code into Bug_FieldChange(FieldName)


    'Set value to BG_USER_01 with RetrieveUserInGroup function
    Bug_Fields("BG_USER_01").Value = RetrieveUserInGroup()
    'Synch the Assigned To Lookup List with the AssignedTo User List
    Bug_Fields("BG_RESPONSIBLE").Value = Bug_Fields("BG_USER_01").Value

    Here's the US_GROUP value correspond to group name in ALM :


    Table : USERS

    US_USERNAME                    US_GROUP                                      Group Name

    admin                                     10001000                                        TDAdmin
    user_1                                    10001000                                        TDAdmin
    testmanager1                     00001010                                        TestManager
    tester1                                   00001100                                        Tester


    Need advice, am I getting somewhere to what I want?

  • No, that won't work. You function will only return the last username on the list - it will not produce a list. Moreover, selecting usernames based on the bitmask will only work for users who are members of exactly the same groups (in your example two specific groups).


    So you had better build the lookup lists with user names manually. Then in Bug_MoveTo (and Bug_New) you can set the list associated with the field:


    If User.IsInGroup("ABC") Then
        Bug_Fields("BG_USER_01").List = List("UserList1") 
    ElseIf User.IsInGroup("DEF") Then
       Bug_Fields("BG_USER_01").List = List("UserList2") 
    End If
  •  : Just want to mention that your this note has helped me to resolve a query that I had in this regard.

    Thank you.