A fetch validation rule defines what rule definition will be used to validate the fetch’s data and how failed validation is handled on the Agentry Client. The rule referenced is called in a Boolean context and is expected to return true or false. False indicates failed validation, which may be treated as a warning or error. Messaging may be displayed to the user in relation to failed validation. An error requires the user to change the offending value(s) before proceeding. A warning displays an informational message giving the user the option to change the value(s), but does not require a change.
Not every fetch will have validation rules. Certain types of values do not need to be validated using a validation rule. Simple requirements such as the size of a string value or the minimum and maximum values of a numeric property can be enforced by the property itself. In other cases the data may simply not need to be validated.
Validation rules are used when more complex validation is required, such as when the valid value for a property is dependent on the value of a second property. Also, validation rules offer the flexibility to differentiate between a warning and an error. With a warning, the user is given the option of changing the value that violates the rule or leaving it as is. If treated as an error, the user must change the value before being allowed to proceed.
Validation rules are evaluated when the user clicks any navigation buttons in the wizard screen set displaying the fetch. If a validation rule references a property not yet displayed in the wizard, it will not fail validation. A false return by the rule is treated as a validation failure and the validation rule definition will then dictate the behavior of the Client.