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
David OvellaDavid Ovella 

Is it possible to validate an object to has just one record in a day?

Hi everyone,
I want to know if it is possible that an object can only have a record created by day depending on some criteria

Example:
Object: "OD__c"            Custome Field: Date__c, Suc__c.

this Object has already a record created today called
Name: OD-001     02/Feb/2016         Suc: Central

so if I try to create another one with the same values I would like to get an error
Name: OD-002   02/Feb/2016          Suc: Central

can this object be validated if it meet the criteria 
If (Date__c==Today() && Suc__c == "Central")







 
Best Answer chosen by David Ovella
Sumeet_ForceSumeet_Force
Hi David,
You can use following approach :
Explaining using Opportunity object:

1. Create external ID text field on opportunity object and mark it as unique.
2. Create WF on Oppty to update this field with Date-Month every time record is created.

If record is created second date with same external ID field, then it will result in error as external ID is not unique and create operation will roll back.

Hope this helps.