Validation Rules

Learn how you can implement custom rules to improve the quality and consistency of your data or create new custom business rules.

Validation rules let you create rules that check your customer and booking data to make sure they meet specific criteria. For example, you can make specific fields required or meet a specific pattern.

Validation rules are applied to records created or updated from the Nexudus dashboard, the members portal or the API.

You can apply validation rules to three types of records.

  • Customers

  • Bookings

  • Commands.

To create a validation rule:

  1. If the side menu is not visible, click .

  2. In the side menu, click Settings.

  3. In the Features section, click Validation Rules.

  4. Click Add Validation Rule.

  5. Complete the Validation Rule details and click Save.

An example validation rule checking a field is no blank or empty.

Validation Rule Formulas

The formula for validation rules has to always return a true or false value. When the returned value is true the validation rule system will allow the record to be created or updated, otherwise the validation error message set in the details of the rule will be shown to the user and the record won't be created or updated.

The following variables are available to be used in the formula:

Variable

Description

user

The currently logged in user.

user.email

The email address of the currently logged in user.

record

The record the formula is being evaluated for. This can be a booking or a customer.

The following functions are available in all formulas:

Name

Description

PI

The value of PI

E

The value of E

Abs

Returns the absolute value of number

BigMul

Produces the full product of two 32-bit numbers.

Ceiling

Returns the smallest integral value that is greater than or equal to the specified decimal number.

Floor

Returns the largest integer less than or equal to the specified decimal number.

Log(x,b)

Returns the logarithm of a specified number in a specified base.

Max(a,b)

Returns the larger of two numbers

Min(a,b)

Returns the smaller of two numbers.

Round(d,decimals)

Rounds a number to a specified number of fractional digits.

Truncate(d)

Calculates the integral part of a specified number.

IsMatch(input,pattern)

Indicates whether the specified regular expression finds a match in the specified input.

ToBoolean

Converts a value to a boolean

ToDateTime

Converts a value to a date

ToDecimal

Converts a value to a decimal number

ToDouble

Converts a value to a double number

ToInt32

Converts a value to a integer

ToInt64

Converts a value to a integer

ToString

Converts a value to a string

Example Formulas:

Setting a field as required

The example below checks the TaxIDNumber field (TAX / VAT Number) is present.

An example validation rule checking a field is no blank or empty.
record.TaxIDNumber <> null AND record.TaxIDNumber <> ""

Checking a field value meets a specific value

The example below checks the TaxIDNumber field (TAX / VAT Number) meets a specific regular expression.

An example validation rule checking a field meets the UK VAT number pattern.
IsMatch(record.TaxIDNumber, "GB([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})")

Checking the currently logged in user is a full unrestricted admin.

user.IsAdmin

‚Äč