Example: Changing Field Properties when a Field Changes
This example demonstrates how you can change the properties of a field when a different field is changed.
In this example, if the status of the defect (
BG_STATUS)
is changed to Closed
, the user must provide a value in the field Closed in Build (BG_CLOSING_VERSION).
Add the code to the Bug_FieldChange
event procedure, to make the Closed in Build field a required field if the status is changed to Closed
.
Sub Bug_FieldChange(FieldName) On Error Resume Next If FieldName= "BG_STATUS" then If Bug_Fields("BG_STATUS").value="Closed" then Bug_Fields("BG_CLOSING_VERSION").IsRequired=True Else Bug_Fields("BG_CLOSING_VERSION").IsRequired=False End If Else ' Enter your code here. End If PrintError "Bug_FieldChange" On Error GoTo 0 End Sub