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
Ravi_SFDCRavi_SFDC 

Datatime Datatype Validation Rule

I do have Date/Time DataTypefor Start Date and End Date

Start Date and End Date every time should be EQUAL and both can't be in future dates. But can be in previous dates.

Issue is Start Date is TODAY, but End Date is taking the value as 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 date record.

Your hep would be really apprciated.

Regards
Ravi

 

 

VinayVinay (Salesforce Developers) 
Hi Ravi,

Do you have validation rule,  Can you share if you have any?
DATETIMEVALUE(Start Date)=DATETIMEVALUE( End Date) 
Thanks,
Ravi_SFDCRavi_SFDC

Hi Vinay,

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
        )
    )
)