Transaction Validation Rule
A rule validation reference for handling complex data transactions.
A transaction validation rule defines what rule definition will be used to validate the transaction’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 transaction 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 information may not need to be validated. An example of this is some sort of note or description entry where the user is entering free form text.
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 transaction. 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 Agentry Client.
Validation Rule Attributes
- Rule: This attribute specifies the rule definition within the same module to be used as a validation rule for the transaction. The rule is expected to return a Boolean value is evaluated in the context of the current transaction instance.
- Type: This attribute can be set to either “Warning” or “Error” and determines how a false return from the rule is treated by the validation rule. Warning means a failed validation does not require the user to change the value. The user will be displayed a message and given the option to change the value or keep it as set. An error type requires the user to change the value before proceeding.
- Caption: This is the text displayed in the title bar of the message for the validation rule.
- Text: This is the message displayed to the user when validation fails.
- OK Label: This is the text to label the OK button for the message screen on the Agentry Client.
- Cancel Label: This is the text to label the Cancel button for the message screen on the Agentry Client. This attribute is available only when the Type attribute is set to “Warning.”