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
Miguel Egas 7Miguel Egas 7 

Validation Rule for future date is not working

Hi Folks, I have the following validationformula that is supposed to prevent the creation of the record unless the criteria is met, however, after implementing the validation, the record still gets created if a choose a date in the past.  For example if today is nov 13, and I chose Oct 20, the record should not be created.  What am I doing wrong?
 
AND(
  WEEKDAY(Survey_Requested_Date__c) <> 2,  /* Not Monday */
  WEEKDAY(Survey_Requested_Date__c) <> 6,  /* Not Friday */
  Survey_Requested_Date__c >= TODAY()      /* Date is in the future */
)

 
Best Answer chosen by Miguel Egas 7
Miguel Egas 7Miguel Egas 7
Never mind, I fixed my own error, but just in case someone else has the same problem, here is the solution:
AND(
Survey_Requested_Date__c>=Today(),
WEEKDAY(Survey_Requested_Date__c) = 2 || WEEKDAY(Survey_Requested_Date__c) = 6
)
Basically, the formula needed to be AND OR
Th pipes || are an OR statement, thus the second condition for AND includes and OR.  

 

All Answers

Miguel Egas 7Miguel Egas 7
Never mind, I fixed my own error, but just in case someone else has the same problem, here is the solution:
AND(
Survey_Requested_Date__c>=Today(),
WEEKDAY(Survey_Requested_Date__c) = 2 || WEEKDAY(Survey_Requested_Date__c) = 6
)
Basically, the formula needed to be AND OR
Th pipes || are an OR statement, thus the second condition for AND includes and OR.  

 
This was selected as the best answer
Stam BaughStam Baugh
Thanks for sharing this for more visit : https://topfollowapks.net/