Fields Dependencies



User's Requirement


When a change of value of the "Assign To" field in a defect is done another field must be automatically update with the associated User Name.



Proposed Solution


Creation of a New Fields for Bug table, BG_USER_01, with label "UserName". On "BG_RESPONSIBLE" Value Changing will be update the "BG_USER_01" Value within the UserName of the selected "BG_RESPONSIBLE" Value.






Implementation on the Product


It will be create a user field with label "UserName" for Defect Entity. This operation must be done from "Project Entities" entry in Customization... section:





By selecting the "New Field" button it is possible the new field creation. For this case we have only to set the value for the label as "UserName" and declare the type as string of 255 chars.



Once we've done these operations we have to insert instruction into the Bug_FieldChange event inside Defect Module in the Script Editor to call the function that returns the name of the selected user.



Sub Bug_FieldChange(FieldName)

On Error Resume Next

if FieldName = "BG_RESPONSIBLE" then

   'set the BG_USER_01 field with the value returned from strNominativo function

   Bug_Fields.Field("BG_USER_01").Value = strNominativo(Bug_Fields.Field(FieldName).Value)

end if

On Error Goto 0

End Sub


Function strNominativo(Usr)

On Error Resume Next

Dim theUser, Res

Res = ""


set theUser = TDConnection.Customization.Users.User(Usr)

Res = theUser.FullName

set theUser = Nothing


strNominativo = Res


On Error Goto 0

End Function




Pag: <<    <    >    >>