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
satya ravi teja kantamsatya ravi teja kantam 

regarding the creation of validation rule

hi everyone,
i was trying to create a validation rule for date/time field to prevent the entry duplicate record ; in more detail i have created field using the concept of Master detail relationship and i want the the record in the date/time tobe unique i.e., if a user enters a date and time and another user tries to enter the same date and time it should show an error
kindly help me with this scenario 
Thanks Regards
Raviteja 
AnkaiahAnkaiah (Salesforce Developers) 
Hi Satya,

Can you please explain more about your requrement?

what is the object name & based on which field you need to check the duplicate record?

Regards,
Ankaiah Bandi
RyanAtTGHRyanAtTGH
There is no way to use Validation Rules to prevent duplicate records. Validation Rules just compart the current records data, user info, etc., but there is no comparison to other records of the same object. 

To do so, you would need a Trigger or a Flow, that run 'Before Insert.' The Flow would just 'error out' without much helpful info, but a Trigger could provide a custom message to inform the user why they are not able to save. 
satya ravi teja kantamsatya ravi teja kantam
The field is of date/time datatype