Overview
Conflict Rules let you enforce your business rules on reservations.
You can create simple and complex rules with the operators and functions described below.
You can use fields on the reservation, and fields of the related dimension record if you link the rule to a dimension.
The formula itself is where you define the condition for the rule. If the formula evaluates to true, it results in a conflict. You can use operators such as == (equal), != (not equal), > (greater than), >= (greater than or equal to), < (less than), <= (less than or equal to), AND, OR, CONTAINS, LIKE, STARTSWITH, NOT and ISBLANK.
There are also functions for calculations and for filtering lists. When the rule is linked to a dimension, you can use special variables such as overlappingReservations and matchingAvailabilities to build rules for availability checking and double bookings.
You can choose between hard and soft conflicts, where a hard conflict will block the reservation, and a soft conflict will only display a warning. The validation message you provide will be shown to the user to explain why the reservation is not allowed.
By combining operators, functions, and variables, you can create simple or advanced rules to handle conflicts based on specific criteria, such as resource availability, overlapping reservations, and more.
Getting started
To turn on Conflict Rules, go to GoMeddo Settings > GoMeddo Setup > System Settings and enable Use the Conflict Rules engine in the Validation section.
After you enable it, GoMeddo no longer uses the conflict checking configured on the dimensions and only uses the rules.
To apply your rules to only some reservations, use Rulesets. A Ruleset groups Conflict Rules and filters the reservations they apply to. See Rulesets.
Creating and editing rules
To create a rule, go to the GoMeddo Rules tab, click New, select the Conflict Rule record type, and click Next. To edit a rule, select it from the list.
-
Enter a GoMeddo Rule Name. Optionally, select a Dimension to link the rule to. Keep Is Active selected to use the rule. An inactive rule doesn't run and isn't validated when you save it.
-
Enter the Formula. Use Function, Insert field, and Operators to add parts of the formula.
If the formula is true, the reservation has a conflict. Click Check Syntax to validate your rule. -
Select the Conflict Type: Hard blocks the reservation, Soft only shows a warning. Ranking doesn't block anything: it gives matching results a weight, so better matches are shown first. See Ranking Rules.
-
Enter the Validation Message. GoMeddo shows it to the user as the reason why the reservation isn't allowed. To translate the message, use a custom label in the form
$Label.labelApiName. -
Optionally, enter an Execution Order. Rules with a lower Execution Order run earlier, so you control which rules are checked first.
-
Click Save. If Is Active is selected, GoMeddo checks the syntax and the referenced fields again.
Rules that use overlappingReservations, matchingAvailabilities, or a custom rule variable always run after rules that don't. Rules without an Execution Order run last.
When the formula is true, the reservation has a conflict. This is why the rules are called Conflict Rules.
Validation messages
When a Conflict Rule blocks (or soft-flags) a reservation, the Validation Message is shown to the user to explain why. You can author it in one of two modes, controlled by the Validation Message Is Formula checkbox on the rule.
|
Mode |
Validation Message Is Formula |
Live values from the reservation? |
|---|---|---|
|
Regular (plain text) |
Unchecked (default) |
No |
|
Formula |
Checked |
Yes |
Regular (plain text) messages
This is the default, and behaves as it always has. The Validation Message field is shown to the user as-is, e.g. Resource capacity exceeded.
-
No merge fields. The text is static: there is no way to inject live values from the reservation in this mode. Use a Formula message if you need values.
-
Custom label support. If the whole field value is a label reference, e.g.
$Label.CapacityExceeded, it is resolved to that custom label's translated text, so the message shows in the running user's language. This must be the entire field value, written unquoted.-
Case-insensitive:
$Label.CapacityExceeded,$label.capacityexceededand$Label.CAPACITYEXCEEDEDall resolve the same way. -
For a packaged GoMeddo label use the namespaced form:
$Label.B25__CapacityExceeded. A custom label of your own needs no prefix. -
If the label doesn't exist, the literal text
$Label.xis shown. This does not block saving the rule.
-
A label that contains placeholders like {0} is not filled in when used in a plain text message: you would see the literal {0}. Use a Formula message with formatString to fill placeholders (see below).
Formula messages
Check Validation Message Is Formula. The Validation Message field then becomes a formula that must evaluate to text. It uses the same language as the rule's condition formula.
-
The formula is checked when you save the rule. An invalid formula, or one that doesn't evaluate to text, blocks the save and the error is shown on the Validation Message field.
-
The rendered message is truncated to 255 characters.
formatString(template, arg0, arg1, ...)
Builds text from a template, replacing {0}, {1}, … with the values you pass in, in order:
formatString("Quantity {0} exceeds capacity {1}", B25__Quantity__c, B25__Resource__r.B25__Capacity__c)
renders as Quantity 6 exceeds capacity 5. Numbers drop trailing zeros; dates and datetimes use the locale-aware format.
A custom label can be used as the formatString template, so the message text is translatable. Given a label CapacityExceeded = The quantity exceeds {0}''s capacity ({1}).:
formatString($Label.CapacityExceeded, B25__Resource__r.Name, B25__Resource__r.B25__Capacity__c)
renders as The quantity exceeds Board Room's capacity (5). A label can also be used bare, e.g. $Label.SomeStaticMessage, if it has no placeholders.
JOIN(list, separator)
Joins a list of values into a single string. The separator is optional and defaults to ", ". This is useful for listing every conflicting record, for example:
formatString($Label.ConflictsWith, JOIN(FOREACH(overlappingReservations AS r, r.B25__Title__c), ", "))
renders as Conflicts with: Team sync, Board review.
Examples
|
Formula |
Result |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Operators
Conflict Rules support the following operators:
|
Operation |
Description |
Example |
|---|---|---|
|
== |
Checks if two values are equal. Returns true if they are, false otherwise. |
|
|
!= |
Checks if two values are not equal. Returns true if they are not, false otherwise. |
|
|
> |
Checks if the left value is greater than the right value. Returns true if it is, false otherwise. |
|
|
>= |
Checks if the left value is greater than or equal to the right value. Returns true if it is, false otherwise. |
|
|
< |
Checks if the left value is less than the right value. Returns true if it is, false otherwise. |
|
|
<= |
Checks if the left value is less than or equal to the right value. Returns true if it is, false otherwise. |
|
|
- |
Subtracts two numbers. Can also be used to subtract a number of days from a Date/Datetime, And to subtract two Dates/Datetimes to get the number of days between them. |
Getting the duration of the reservation
|
|
+ |
Adds two numbers. Can also be used to add a number of days to a Date/Datetime. |
|
|
/ |
Divides two numbers. |
|
|
* |
Multiplies two numbers. |
|
|
<Text> CONTAINS <Text> |
Checks if a text value contains a different bit of text. Returns true if it does, false otherwise. |
|
|
<List> CONTAINS <Value> |
Checks if a list contains a value. Returns true if it does, false otherwise. |
|
|
<List> CONTAINS <List> |
Checks if a list contains all the entries in the second list. Returns true if it does, false otherwise. |
|
|
STARTSWITH |
Checks if a text value starts with the specified substring. Returns true if it does, false otherwise. |
|
|
LIKE |
Performs a pattern matching comparison (RegEx) between a text value and a specified pattern. Returns true if the pattern matches, false otherwise. |
Also see: https://help.salesforce.com/s/articleView?id=sf.customize_functions_regex.htm&type=5 |
|
AND |
Returns true if the conditions on both sides are true, false otherwise. |
|
|
OR |
Returns true if at least one of the conditions is true, false otherwise. |
|
|
NOT |
Negates the Boolean value of an expression. Returns true if the expression is false, false if it is true. |
|
|
ISBLANK |
Checks that the value is null or empty (blank). Returns true if it is blank, false otherwise |
|
|
ISNOTBLANK |
Checks that the value is neither null nor empty (blank). Returns true if it is not blank, false if it is blank |
|
|
[index] |
Array index operator. Returns the element at the specified index in a list (starting with zero). For example |
|
Put a space before and after AND, OR, CONTAINS, LIKE and STARTSWITH. Without the spaces, GoMeddo doesn't recognize them as operators.
Functions
Rules serve different functions, with some of them returning numerical values that you can use in your formula.
|
Function |
Description |
Example |
|---|---|---|
|
COUNT(list) |
Counts the number of items in the list and returns it as a number |
|
|
COUNTUNIQUE(list) |
Counts the number of unique items in a list and returns it as a number. Currently supported for primitive data types (integers, strings, etc…). |
|
|
FILTER(list AS variableName, condition) |
Loops over a list and returns only the items that pass the condition as a new list. You can reference the element being processed with variableName. |
|
|
FOREACH(list AS variableName, expression) |
Loops over a list and returns a list of the result of the expression for each entry in the original list. |
|
|
IF(condition, then, else) |
When the value of the condition is true, return the value of then, otherwise return the value of else. |
|
|
SUM(listofnumbers) |
Returns the sum of all the numbers in the list. |
|
|
SUM(listofrecords, numberfield) |
Returns the sum of all the number fields values. |
|
|
SUM(listofrecords, numberfield, default) |
Returns the sum of all the number fields values. Using the default for any null values. |
|
|
MIN(listofnumbers) |
Returns the lowest number in the list. |
|
|
MIN(listofrecords, numberfield) |
Returns the lowest of all the number fields values. |
|
|
MAX(listofnumbers) |
Returns the highest number in the list. |
|
|
MAX(listofrecords, numberfield) |
Returns the highest of all the number fields values. |
|
|
SPLIT(textToSplit) |
Returns a list of the text split by semicolons so test;test1 to [test, test1] |
|
|
SPLIT(textToSplit, separator) |
Returns a list of the text split by the given separator |
|
|
NOW() |
Returns the current datetime. |
|
|
TODAY() |
Returns the current date |
|
|
IsNotAvailable() |
Returns true if in basic availability checking the dimension is not available. Taking into account inheritance and unavailabilities. It is the equivalent of |
|
You can combine the functions to create more in-depth rules.
-
COUNT(FILTER(records AS record, record.number_field__c > 5)) > 0-> returns TRUE if at least one record has a value higher than 5
Rules linked to a dimension
When you link your rule to a dimension, the following special variables become available for use in the formula.
-
overlappingReservations
overlapping reservations with the reservation being checked
COUNT(overlappingReservations) > 0
This rule would make sure that no overlapping reservation are allowed -
matchingAvailabilities
Allowing you to use the availability or unavailability of the related dimension in your formula.
This list ofB25__Availability__crecords is ordered from most important to least important.
COUNT(matchingAvailabilities) == 0
Reservation not allowed when there is no availability or if there are unavailabilities. -
dimensionElement
Will contain the name of the dimensionField/dimensionJunction that was used to link the reservation to the dimensionRecord the rule is currently running on. For example if you have a reservation with both the contact field filled in and a contact junction filled in the rule will be evaluated for both the contact linked through the field and for the contact linked through the junction. During the evaluation for the field this will have the value B25__Contact__c and then when being evaluated for the contact linked through the junction it will have the valueb25__reservation_contacts__r(the relationship name from the junction to the reservation). This variable can also be accessed on overlapping reservations to see how they are linked to this record. -
junctionIndex
If the link to the dimension record is through a junction this variable will contain the index of the junction that is currently being evaluated. so junctionRelationshipName[junctionIndex] will get you that junction. This can be used to get for example a checkbox field on that junction to determine if that junction is relevant for conflict checking. This variable can also be accessed on each overlapping reservation for the same purpose.
Custom rule variables
GoMeddo creates the custom rule variable overlappingSiblings when you install it. You can use it in any rule, also when the rule isn't linked to a dimension. It contains the reservations that overlap the reservation being checked on resources with the same parent resource.
COUNT(overlappingSiblings) > 0
This rule blocks a reservation when a resource under the same parent resource is already booked at that time.
Use a custom permission in a rule
You can also reference and check the permissions of the running user in your rule. Works for GoMeddo permissions and custom permissions.
Use $Permission.Custom_Permission_Name. Write the permission name without a namespace prefix, also for GoMeddo permissions:
COUNT(overlappingReservations) > 0 and $Permission.ALLOW_DOUBLE_BOOKING == false
Comments
Rule formulas allow for limited comments. Any line where the first non whitespace characters are // will be ignored.
Example rules
For ready-made examples, see:
Features not supported by Conflict Rules
-
Unshared conflict checking: Shared vs Unshared Conflict Checking
-
The Timeslot picker: Time Slot Picker (for record pages)
-
Formula fields are often unreliable in Conflict Rules because they are calculated upon saving to the database. Since GoMeddo evaluates rules in real-time, often before the record is saved, these fields may be empty or outdated during validation, leading to silent failures. We recommend using regular fields instead of formula fields when possible, for example, use B25__Resource__r.Name instead of B25__ResourceName__c.