Here is a sample of code that would poll the user group of the user assigned to BG_RESPONSIBLE (Assigned To) and write a value to the field BG_USER_05. You will want to add this code to Bug_FieldChange under the Defects workflow.
Below code would fire at the point of setting a user value to Assigned To then poll the user group and if a match (in this case I used QA Tester group) would then write value of My value to the UDF.
If FieldName = ''BG_RESPONSIBLE'' then
testername = Bug_Fields.Filed(''BG_RESPONSIBLE'').value
If TDConnection.Customization.Users.User(testername).InGroup(''QA Tester'') = True Then
Bug_Fields(''BG_USER_05'').value = ''My value''
Please alter the UDF field DB name as needed to match your UDF, the user group name, and the ''value'' to be written. Can add other values for other groups as needed. The above is just a generic sample for one case.