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
GoJoyGoJoy 

How do I create a validation rule on a Dat Field?

I would like to create a validation rule that Planned Installation Date cannot be less than 7 days from record creation date.
Can you please help?

Planned Installation Date (Date Field)
Planned_Installation_Date__c (API)

 
UC InnovationUC Innovation
Hi Gojoy,

From my understanding, an error should occur if Planned Installation Date is less than 7 days after created date. If this is the case try crating a validation rule with the following in the formula box

Planned_Installation_Date__c < CreatedDate + 7

The validation rule will fire if this formula is true

Hope this helps!

AM
Ankit SehgalAnkit Sehgal
Use this formula in your validation rule

Planned_Installation_Date__c - DATEVALUE(CreatedDate ) < 7
UC InnovationUC Innovation
I appologize for my incorrect formula. I forgot to add the function around the created date to convert it from a Datetime to a Date representation. Use this formula instead. More on this functions as well as others used in formulas can be found here (https://help.salesforce.com/htviewhelpdoc?id=customize_functions_a_h.htm&siteLang=en_US#DATE).

Planned_Installation_Date__c < DATEVALUE(CreatedDate) + 7

Hope this helps!

AM