You need to sign in to do that
Don't have an account?
Anonymouse
How to Validate Custom Date Field to Current or Future Year
Hello,
How may I validate 2 custom date fields to make sure that both are of the current or future year?
This is what I have so far:
Any help would be greatly appreciated.
Sincerely,
Jackie
How may I validate 2 custom date fields to make sure that both are of the current or future year?
This is what I have so far:
AND(OR (YEAR(customField1__c) < YEAR(Today()), YEAR( customField2__c) < YEAR(Today())), true, false)
Any help would be greatly appreciated.
Sincerely,
Jackie
Based the below one both the custom fields should be lesser than this or future year then only it will fire. Because you have use the AND logic.
IF( AND( (YEAR(customField1__c) < YEAR(Today())), (YEAR(customField2__c) < YEAR(Today())) ),true, false )
So if you want like if anyone of this custom field is past then you want fire use the OR logic.
IF( OR( (YEAR(customField1__c) < YEAR(Today())), (YEAR(customField2__c) < YEAR(Today())) ),true, false )
And also check the Validation rule is Active
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Raj
All Answers
AND((
YEAR(customField1__c) < YEAR(Today()),
YEAR( customField2__c) < YEAR(Today()))
),true , false
)
Hi Raj,
I'm afraid it's not working.
This is what I currently have:
I get no errors if I try to create a record with a year that is not current or future. It lets me create the incorrect record with an invalid year. :(
Sincerely,
Jackie
Based the below one both the custom fields should be lesser than this or future year then only it will fire. Because you have use the AND logic.
IF( AND( (YEAR(customField1__c) < YEAR(Today())), (YEAR(customField2__c) < YEAR(Today())) ),true, false )
So if you want like if anyone of this custom field is past then you want fire use the OR logic.
IF( OR( (YEAR(customField1__c) < YEAR(Today())), (YEAR(customField2__c) < YEAR(Today())) ),true, false )
And also check the Validation rule is Active
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Raj
You should be using OR instead of AND.
Use this:
OR(
YEAR(customField1__c) > YEAR(Today()),
YEAR( customField2__c) > YEAR(Today()))
)
Let me know if it helps.
Thanks