I want an example how to compare a new record with old records in order to prevent duplicated records from being inserted.
For example: When I insert a new 'Time Off', I compare the new start date and end date if there is already a requested time off, then an error message will be displayed as:
This Start / End date is already asked. Please choose another start/end date
I've created a field named:
WFError__c in my object as unique field (TEXT type), then I created a workflow on my custom object (
Time_Off__c) there for I created a field update action on that
WFError__c with this formula value
TEXT( Start_date__c ) + TEXT( End_date__c ).