I have a date field (Last_Order_Date__c), in which I am defaulting the value of date to 6 months ahead from today's date.
Default Value for Above Date Field with formula
DATE(
YEAR(TODAY()) + IF(MONTH(TODAY()) > 6, 1, 0),
MOD(MONTH(TODAY()) + 6, 12),
DAY(TODAY())
)
Right now it is defaulting the value correctly. Suppose today is 10/29/2016 .It is defaultly setting to this value 4/29/2017. My first question: Is this formula is correct for making ahead of 6months from today'sdefaulting the date? value to the date which is 6months ahead. Will it also consider Months having 30 and 31st automatically?
I have one more doubt I have one validation rule if we keep less than 6 months date (Last_Order_Date__c )then FYI I am throwing angetting below error message "Last Order Date should be greater than 6 Months from Today."
Validation Rule
IF(Last_Order_Date__c <=(DATE(
YEAR(TODAY()) + IF(MONTH(TODAY()) > 6, 1, 0),
MOD(MONTH(TODAY()) + 6, 12),
DAY(TODAY()))), TRUE, FALSE)
As I am defaulting the value to 6 months ahead .The value of theif today's date field is 410/2931/2017. While Saving2016 and I am using the record it is throwing errorabove formula for 4/29/2017 thisdefault date also.I need it should not throw error if it is 4/29/2017.If it is less than then 4/29/2017 then only throw an error.What Changes should I mention in Validation rule so that it should work fine.?