Check if object already exists

Hello everyone,    I have an application where employees can book resources, in specific date ranges. In the entity Resource, I have a Start Date and End Date. And this entity is connected to Employee. How can I make sure that one employee can book only one resource on one specific date?    E.g.: Employee 1 booked a resource for Monday (Start Date) till Thursday (End Date). Now, Employee 1 tries to book again, this time for Thuesday (which is within the range of Monday till Thursday). The employee should not be able to save the entry. Instead, an error message should appear, that asks the employee to select another range.
1 answers

Retrieving with an Xpath should do the trick for you.

You’ll need to retrieve any objects  where your new object’s start date sits between the start date and end date.

Something like this:

[Start Date<= $<Your Object>/StartDate]
[EndDate >= $<Your Object>/StartDate]


Then do a check on the list. If it’s empty, then nothing continue with the booking, if not show the error.