You need to sign in to do that
Don't have an account?
Ravi_SFDC
Datetime datatype Validation Rule
I do have Date/Time DataType for Start Date and End Date
Start Date and End Date every time should be EQUAL and both can't be on future dates. But can be on previous dates.
The issue is Start Date is TODAY, but the End Date is taking the value as the Previous Date, which shouldn't happen.
FINAL OUTPUT needed, START DATE and END DATE should be the SAME every time. If we have the record for the same date, we shouldn't allow duplicate data record.
Your help would be really appreciated.
Regards Ravi
AND( NOT(ISNEW()), ISBLANK(Id), NOT(ISBLANK(Start_Date_Time__c)), NOT(ISBLANK(End_Date_Time__c)), Start_Date_Time__c >= DATEVALUE(NOW()), End_Date_Time__c >= Start_Date_Time__c, NOT( AND( Start_Date_Time__c >= DATETIMEVALUE(FLOOR(TEXT(Start_Date_Time__c))), End_Date_Time__c < DATETIMEVALUE(FLOOR(TEXT(End_Date_Time__c))) + 1 ) ) )
can you check below formula.
Please note that we cannot check duplicate value using validation rules. You may have to use trigger in this scenerio I guess.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
Hi,
Thank you. I have tried this. This will not work if i select different time for the same date.
Example:
Start Date: Mar 15,2023: 6 AM End Date: Mar 15,2023: 6 PM
Start Date: Mar 15,2023: 7 AM End Date: Mar 15,2023: 7 PM
Both records would get saved in the above scenario.
The record shouldn't be saved even i do have different time for the same day.
I guess you dont have 24 hours enabled on time because of which you are facing the issue. Let me check for 12 hours format.
Thanks,
I changes my Loccale to 12 hour format and checked and it is working as expected. I gave date as below.
Start Date: Mar 7 11:30 am End Date : Mar 7 11:30PM.
The record did not got saved can you check if validation rule is active
Thanks,