You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Corteza Low Code Record Validation

Corteza Low Code provides a powerful, flexible system for record validation that can be used for simple operations such as checking if the field is empty or complex operations that require API access.

All validator errors are instances of validator.ValidatorError class, with the interface of:

interface ValidatorError {
  kind: string;(1)
  message: string;(2)
  meta: { [key: string]: unknown };(3)
}
1 The kind of the error; for now, this can be an arbitrary string that describes the error.
2 The optional message with a more verbose error description. Defaults to err.kind.
3 A loosely defined object that stores any additional metadata, such as field name, recordID, …​

The validation flow

  1. Dispatch beforeFormSubmit event,

    • if any automation script returns a validator.ValidatorError, stop the execution and show the errors,

  2. run the validator.RecordValidator system,

    1. on validator.ValidatorError, dispatch the onFormSubmitError event that can be used to fix the validation errors,

    2. run the validator.RecordValidator system,

      • if errors persist, stop the execution and show the errors,

  3. request record create/update on the API,

    • if the API returns a validator.ValidatorError, stop the execution and show the errors.