I have a custom object "Object1" with validation dates ValidStartDate and ValidEndDate.
Is it possible with a Flow to create a validation that would prevent a new record of Object1 to be created if its Validation period is overlaping with already created ones?
For example, I have a record with Start date 1.01.2024, end date 1.02.2024. I must not be able to create a record with Start date between 1.01.2024 and 1.02.2024. the Strt date of a new record should be avaliable starting from 2.02.2024.
I tried to create a record triggered flow and with GetRecords to get all the records of Object1, then in a decision outcome try to campare the ValidStart of the new record and the ValidEnd from GetRecords, but it's not giving me the option to compare them, or I am not understanding how the GetRecord is working. I would then shoot an error, if there is an overlap. So, is it possible at all to do such a check with a flow, or is it possible only with a trigger?
@AuraEnabled
method so you can use it in your flow is going to ease the pain a bit (e.g. it's fairly simple to find the min start date and max end date in your records going through your flow, then use those to limit the number of existing records you'll query, making it more bulk-friendly).