Validation Rule Formula Functions
  • 18 Apr 2023
  • 3 Minutes to read

Validation Rule Formula Functions


Article Summary

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.

Available Variables

VariablesDescription
userUser currently logged in.
user.emailEmail of the user currently logged in.
recordRecord that the formula will check.

Available Functions for Specific Record Type

FunctionsDescription
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

FunctionsDescription
PIReturns the value of PI.
EReturns the value of E.
AbsReturns the absolute value of number.
BigMulProduces the full product of two 32-bit numbers.
CeilingReturns the smallest integral value that is greater than or equal to the specified decimal number.
FloorReturns 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.
ToBooleanConverts a value to a boolean.
ToDateTimeConverts a value to a date.
ToDecimalConverts a value to a decimal number.
ToDoubleConverts a value to a double number.
ToInt32Converts a value to a 32-bit integer.
ToInt64Converts a value to a 64-bit integer.
ToStringConverts a value to a string.

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.