Validation Rules
Learn how you can implement custom rules to improve the quality and consistency of your data or create new custom business rules.
Last updated
Learn how you can implement custom rules to improve the quality and consistency of your data or create new custom business rules.
Last updated
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:
If the side menu is not visible, click .
In the side menu, click Settings.
In the Features section, click Validation Rules.
Click Add Validation Rule.
Complete the Validation Rule details and click Save.
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 Booking formulas
Name | Description |
MinutesToBooking(booking) | Returns the amount of minutes until the booking starts |
HasTaggedProduct(booking, tag) | Returns true if the booking has a product with a given tag |
HasProduct(booking, productId) | Returns true if the booking a product with a given Id |
ProductQuantity(booking, productId) | Returns the quantity of a product included in a booking |
IsInRole(user, roleName) | Returns true if the user is part a role |
IsInPlan(customer, planName) | Returns true if the customer has an active contract for a plan |
IsInPlan(customer, planId) | Returns true if the customer has an active contract for a plan |
WasIsInPlan(customer, planId) | Returns true if the customer has or had an active contract for a plan. |
HasProduct(customer, productId) | Returns true if the customer has purchased a product (paid or not) |
HasPass(customer, passId) | Returns true if the customer has purchase. |
UnpaidInvoicesAmount(customer) | Returns the total amount in unpaid invoices |
UnpaidInvoices(customer) | RE1 |
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 |
The example below checks the TaxIDNumber field (TAX / VAT Number) is present.
The example below checks the TaxIDNumber field (TAX / VAT Number) meets a specific regular expression.