Example: Field Validation

This example demonstrates how to validate a single field value. For example, the following code segment shows how you can ensure that a user in a specific group cannot lower the priority of a defect.

In this example, if the user is in the QATester group and the BG_PRIORITY field is being modified, the new value of the BG_PRIORITY field cannot be lower than the current value.

This example assumes that in the Priority field list for the project, lower priorities come first when the values are sorted in ascending order. For example, the list meets this requirement if the elements are as follows: 1-Low, 2-Medium, 3-High.

Add the code to the Bug_FieldCanChange event procedure so that it is triggered when the user attempts to change a defect field value.