Preventing Double Room Booking flow.

Automations: 01 Preventing Double Room Booking flow.

Step-by-Step Configuration

1. Select Object & Trigger

  • Object: RoomTrigger the Flow When: A record is created or updated 
  • Set Entry Conditions: (optional but recommended for performance) 
  • Example: Only trigger if Status = Booked or Occupied 
  • When to Run the Flow for Updated Records: 
  • Only when a record is updated to meet the condition requirements 
  • Optimize the Flow For: 
  •  Fast Field Updates (Not suitable since we need custom logic) 
  • Actions and Related Records (Required for custom error handling) 

2. Get Conflicting Room Bookings

  • Element Type: Get Records 
  • Label: Get Conflicting Room Bookings 
  • Object: Room 

Filter Conditions (AND): 

  1. Status = Occupied 
  1. Start Date <= {!$Record.End_Date__c} 
  1. End Date >= {!$Record.Start_Date__c} 
  1. Record ID != {!$Record.Id} (to exclude the current record on update) 
  1. Room Number = {!$Record.Room_Number__c} 

Store Records: 

  • Only the first record 
  • Automatically store all fields 

3. Decision – Check for Overlap

  • Label: Check for Overlap 
  • API Name: Check_for_Overlap 

Outcome 1 – Conflict Found 

  • Condition: 
  • Room from Get Conflicting Room Bookings Is Null = False 
    (i.e., a conflict exists) 
  • Outcome Behavior: 

Execute If the condition requirements are met

4. Custom Error – Room Booking Conflict Error

  • Label: Room Booking Conflict Error 
  • Field to Show Inline Error: Room Number 
  • Error Message: 

“This room is already occupied during the selected date range. Please select a different room or adjust the dates.” 

  • Where to Show Error: 

As an inline error on a field

Result

If a conflicting room booking is found: 

flow throws an inline error preventing the record from being saved.

Course Video