Develop custom validation class

Prev Next

You can use a custom validation rule to validate a field value using a custom validation class.

To set up a custom validation rule, first develop the custom validation class to be applied. The custom validation class must extend the DQSCustomValidationBase base class.

When you extend the DQSCustomValidationBase base class: 

  • Enter a unique and recognizable description() for the class. The description is shown in the lookup of the Class name field of a custom validation rule.

  • Use these methods to indicate to which data the custom class applies:

    • getTablesList(): You can define the tables to which the custom class applies. As a result, you can select the custom class for a custom validation rule with one of the applicable tables defined.

    • getExtendedDataTypesList(): You can assign extended data types to which the custom class applies, for example, 'ExternalItemId'. As a result, you can select the custom class for a custom validation rule with a field defined that uses the same extended data type.

    • getBaseTypesList(): You can define base data types to which the custom class applies, for example, String or Date. As a result, you can select the custom class for a custom validation rule with a field defined with the same data type.

  • Use the validateRecord() method to define the x++ code that runs the validation. This code must return one of these values:

    • True: The value in the validation rule field is valid.

    • False: The value in the validation rule field is invalid.

The base structure of an extended DQSCustomValidationBase class is: