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 JobeDavid Jobe 

Validation using CreateDate

I am trying to develop a validation that checks a date field against the create date. The idea is to make sure the agents are putting in dates after (or on) the date teh case was created. The problem I have discovered is that the createdate field doesn't populate until after save, so a validation referencing it at the creation of a case will not stop an agent. And building a code that references today, may cause a validation error where one shouldn't exist. Is there any way to reference a create date, before the case is officially created?
Raj VakatiRaj Vakati
Hi  David , 
As of now, CreatedDate is Ready the only field. Salesforce will allow us to edit those filed on initial setup of Salesforce by logging a case with Salesforce and user should have Edit read-only fields permission to do.

In you case, it is's not possible I guess. You can use alternative customer filed ( CraetedDate__C) and do the validation on this field. 


Thanks ,
Raj 

 
HARSHIL U PARIKHHARSHIL U PARIKH
Try to use the formula below inside the validation rule.
Custom_Date_Field__c <  DATEVALUE(CreatedDate)
instead of Custom_Date_Field__c field, you should put your field's API name.

Hope it helps!

 
Suraj PSuraj P
OR(AND(ISNEW(),customdate__c>=TODAY()),customdate__c>=Datevalue(createddate))