+ Start a Discussion
KNKKNK 

Validation for current year and Next year

Hi Team,

 

I want to create a validation that only current year and next year values can be created on a object,

 

I am trying in with below way, but it is showing error Missig )'

 

OR (
YEAR(Sales_Plan__c ) <> YEAR (today().year() ),
YEAR(Sales_Plan__c ) <> YEAR (today().year() + 1 )
)

 

Can any one help me on the same

Best Answer chosen by Admin (Salesforce Developers) 
Madhan Raja MMadhan Raja M

Try this Formula:

 

OR( VALUE(Sales_Plan__c) <> YEAR(TODAY()), VALUE(Sales_Plan__c) <> (YEAR(TODAY()) + 1))

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

Madhan Raja M

 

All Answers

SFFSFF
OR(
YEAR(Sales_Plan__c) <> YEAR(TODAY()),
YEAR(Sales_Plan__c) <> (YEAR(TODAY()) + 1))

 

 

SFAdmin5SFAdmin5

OR(
YEAR(Sales_Plan__c) < YEAR(TODAY()),
YEAR(Sales_Plan__c) > (YEAR(TODAY()) + 1))

KNKKNK

Again it is showing same error with the below one.I chaned year to Text as that filed is Text data type

 

OR(
"TEXT"("Sales_Plan__c") <> YEAR(TODAY()),
"TEXT"("Sales_Plan__c") <> (YEAR(TODAY()) + 1)
)

Madhan Raja MMadhan Raja M

Try this Formula:

 

OR( VALUE(Sales_Plan__c) <> YEAR(TODAY()), VALUE(Sales_Plan__c) <> (YEAR(TODAY()) + 1))

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

Madhan Raja M

 

This was selected as the best answer