function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Validation rule to prevent insert record between two dates

Hi I am trying to do is write a validation rule for a custom object where users can pass in a from and to date. Now I am trying to make sure that they can't put another record between those 2 dates i.e. from and to dates
for example:
record1: from: 23 dec 2015 to: 24 dec 2015 fine
record2: from: 24 dec 2015 to: 25 dec 2015 Error
record3: from: 1 dec 2015 to: 23 dec 2015 Error
record4: from: 1 dec 2015 to: 11 dec 2015 fine
praveen sonepraveen sone
Your Question is little tricky but to get it solved at the earliest, I suggest you to post it in "answers" community which is mainly focused on config and design problems.
UC InnovationUC Innovation
Hi VT,

This problem cannot be solved using validation rules, because you're trying to look at every record in the org. The validation rule just looks at one record at a time. To accomplish this you're going to need a trigger to loop through all of your records and check the date against each one.