+ Start a Discussion
SFDC2012SFDC2012 

Validation Rule

I am trying to write this validation rule

 

 

OR(AND($RecordType.Name ="Opportuntiy", ISPICKVAL( StageName , "Closed Won") ,ISBLANK(Revenue_Start_Date__c )))

 

This works but I need the Revenue Start date to be >= to close date thats on the Opportunity. 

how can I fix this rule to make it work. 

 

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
jhurstjhurst

Hello.

 

I am not quite sure what you are trying to accomplish.  A couple of things:

 

1. The formula as it is has an unnecessary "AND()" criteria.  You only have one logical test inside the AND()....the OR() test.  The formula will bahve teh same if you use:

 

     AND($RecordType.Name ="Opportuntiy", ISPICKVAL( StageName , "Closed Won") ,ISBLANK(Revenue_Start_Date__c))

 

2. The test you have now fires only if Revenue_Start_Dae__c is empty.  If it is empty, then it will never be >= the Opportunity Close Date.

 

If I understand what you want (to fire the validation error if it is an Opportunity RTm the stage is "Closed Won" and the Revenue_Start_Date__c is empty or is >- to Close Date, then the formula would be:

 

     AND($RecordType.Name ="Opportuntiy", ISPICKVAL( StageName , "Closed Won") ,OR(ISBLANK(Revenue_Start_Date__c), Revenue_Start_Date__c >= CloseDate))

 

Hope this helps.

Jay

All Answers

jhurstjhurst

Hello.

 

I am not quite sure what you are trying to accomplish.  A couple of things:

 

1. The formula as it is has an unnecessary "AND()" criteria.  You only have one logical test inside the AND()....the OR() test.  The formula will bahve teh same if you use:

 

     AND($RecordType.Name ="Opportuntiy", ISPICKVAL( StageName , "Closed Won") ,ISBLANK(Revenue_Start_Date__c))

 

2. The test you have now fires only if Revenue_Start_Dae__c is empty.  If it is empty, then it will never be >= the Opportunity Close Date.

 

If I understand what you want (to fire the validation error if it is an Opportunity RTm the stage is "Closed Won" and the Revenue_Start_Date__c is empty or is >- to Close Date, then the formula would be:

 

     AND($RecordType.Name ="Opportuntiy", ISPICKVAL( StageName , "Closed Won") ,OR(ISBLANK(Revenue_Start_Date__c), Revenue_Start_Date__c >= CloseDate))

 

Hope this helps.

Jay

This was selected as the best answer
b-Forceb-Force

formula

 

AND(

$RecordType.Name ="Opportuntiy",

ISPICKVAL( StageName , "Closed Won") ,

OR(ISBLANK(Revenue_Start_Date__c),Revenue_Start_Date__c >= CloseDate)

)

SFDC2012SFDC2012

thank you for your help.