---
title: "Validation Rule Formula Functions"
slug: "validation-rule-formula-functions"
updated: 2023-04-18T09:28:32Z
published: 2023-04-18T09:28:32Z
canonical: "help.nexudus.com/validation-rule-formula-functions"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validation Rule Formula Functions

All validation rules rely on formulas that must always return a **true** or **false** value. When the rule returns **true**, it is validated and the system allows the record creation or update. When the rule returns **false**, it isn't validated, the system prevents the record creation or update, and displays the error message defined in the rule.

          Feeling a bit overwhelmed by all the options available below?

          

We have heaps of validation rule examples to help you set up common checks under [Validation Rules Examples](/v3/docs/validation-rules-examples).

## Available Variables

| Variables | Description |
| --- | --- |
| **user** | User currently logged in. |
| **user.email** | Email of the user currently logged in. |
| **record** | Record that the formula will check. |

## Available Functions for Specific Record Type

| Functions | Description |
| --- | --- |
| **BookingsCountThisDay (booking)** | Returns the **number** of bookings recorded that day . |
| **BookingsCountThisDayByResource (booking)** | Returns the **number** of bookings recorded that day for the resource you're trying to book. |
| **BookingsCountThisDayByType (booking)** | Returns the **number** of bookings recorded that day for the resources of the same type as the resource you're trying to book. |
| **BookingsCountThisMonthByResource (booking)** | Returns the **number** of bookings recorded that month for the resource you're trying to book. |
| **BookingsCountThisMonthByType (booking)** | Returns the **number** of bookings recorded recorded that month for all resources of the same type as the resource you're trying to book. |
| **BookingsCountThisWeekByResource (booking)** | Returns the **number** of bookings recorded that week for the resource you're trying to book. |
| **BookingsCountThisWeekByType (booking)** | Returns the **number** of bookings recorded that week for all resources of the same type as the resource you're trying to book. |
| **MinutesToBooking(*booking*)** | Returns the **number** of minutes until the booking start. |
| **HasTaggedProduct(*booking*, *tag*)** | Returns **true** if the booking has a product with a given tag. |
| **HasProduct(*booking*, *productId*)** | Returns **true** if the booking has 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 has the given 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 purchased a given product or have it in their basket. |
| **ProductQuantity(*customer*, *productId*)** | Returns the **quantity** of a product if the customer purchased it or have it in their basket. |
| **PaidProductQuantity(*customer*, *productId*)** | Returns the **quantity** of a product the customer purchased and paid. |
| **HasPass(*customer*, *passId*)** | Returns **true** if the customer has a given pass. |
| **UnpaidInvoicesAmount(*customer*)** | Returns the monetary **amount** of all unpaid invoices for a customer. |
| **ToLocalTime(time, business)** | Converts a UTC time to a local time for the given business. |
| **ToLocalTime(*time*, *booking*)** | Converts a UTC time to a local time based on the business of the resource the passed-in booking is for. |
| **MinutesFromMidnightFromTime(*booking*)** | Returns the number of minutes since midnight based on the start time of the passed-in booking. |
| **MinutesFromMidnightToTime(*booking*)** | Returns the number of minutes since midnight based on the end time of the passed-in booking. |
| **HasOveralappingBooking(*booking*)** | Returns true if the customer has more than one booking overlapping with the booking being created or updated. |
| **HasOveralappingBookingByType(*booking*, *resourceTypeId*)** | Returns true if the customer has more than one booking for a resource of the type passed in overlapping with the booking being created or updated. |
| **HasOveralappingBookingByGroupName(*booking*, *groupName*)** | Returns true if the customer has more than one booking for a resource with the group name passed in overlapping with the booking being created or updated. |

## Available Functions in all Formulas

| Functions | Description |
| --- | --- |
| **PI** | Returns the value of PI. |
| **E** | Returns 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 32-bit integer. |
| **ToInt64** | Converts a value to a 64-bit integer. |
| **ToString** | Converts a value to a string. |
