You need to sign in to do that
Don't have an account?
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
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
https://success.salesforce.com/answers
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.