Wedid: Detect Overlapping Time

Challenges

Customer has an Appointment custom object. This object has the following fields:
  • Start Time
  • End Time
A solution is required so that the same person won’t be double booked within the same period. Whenever an Appointment record is created, the solution will need to consider the following scenarios:
  • Appointment A Start Time does not fall within Appointment B Start Time and End Time
  • Appointment A End Time does not fall within Appointment B Start Time and End Time
  • Appointment A Start Time and End Time do not fall within Appointment B Start Time and End Time
When an overlap event is detected, the User can look at overlap Appointment and decide how to handle it.

Solution:

Provide a custom validation to prevent overlapping Appointment

Related Objects Custom Objects (Appointment)
Components Apex Class, Apex Trigger
Complexity Medium