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
manliamanlia 

Validation rules on picklist field depending on certain Stage

Hi All,

 

I'm trying to create a validation rules on a "picklist" field based when certain opportunity stage is selected.

I couldn't find anything similar to this issue.

For example:

I have a picklist field called "Primary Reason" that is required when an Opportunity Stage "Lost" or "Award" is selected (which is also a picklist field).  I couldn't figure out the syntax since both of these are picklist fields.

 

Any help is appreciated.

Thanks!

manlia

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Do your "Lost" and "Award" Opportunity Stages both mean that the Opportunity is Closed (Won/Lost)?  If they do, then you can just us a Validation Formula like this one.  

 

 

AND(IsClosed, ISPICKVAL(PrimaryReason__c, ""))

 

 

If there are other "Closed" Opportunity Stages that you want to omit from the VR then you have to do something like this

 

AND(ISPICKVAL(PrimaryReason__c, ""),
OR(
ISPICKVAL( StageName , "Award"),
ISPICKVAL( StageName , "Lost")))

 PS.  You owe me a beer! http://beeradvocate.com/beer/profile/863/7971

 

All Answers

Steve :-/Steve :-/

Do your "Lost" and "Award" Opportunity Stages both mean that the Opportunity is Closed (Won/Lost)?  If they do, then you can just us a Validation Formula like this one.  

 

 

AND(IsClosed, ISPICKVAL(PrimaryReason__c, ""))

 

 

If there are other "Closed" Opportunity Stages that you want to omit from the VR then you have to do something like this

 

AND(ISPICKVAL(PrimaryReason__c, ""),
OR(
ISPICKVAL( StageName , "Award"),
ISPICKVAL( StageName , "Lost")))

 PS.  You owe me a beer! http://beeradvocate.com/beer/profile/863/7971

 

This was selected as the best answer
Steve :-/Steve :-/

Have you had any luck with this, or do you need any additional help?

manliamanlia

Thank you.  This works prefect!

symantecAPsymantecAP

I have a similar kind of issue. I am trying to populate a pick list field from a CLIENT TIBCO.

My pick list field "Offer_type__c" is Required Field. It has a picklist value called "Datasheet" 

Even if I pass "Datasheeetsssss" to this field still it accepts it and a record is created. or if dont even pass a value the record is created. What would be the validation rule on this Kindly help.

Steve :-/Steve :-/

Can you post your VR Formula using the Code Clipboard so I can take a look at it?  Also post the complete list of Picklist values (exactly as they appear in the Picklist menu) as well as any other Fields and datatypes in your VR.

BDVBDV

This is exactly what I needed.  Thanks @Stevemo!

Josh HolcombJosh Holcomb
Hey all - I'm having trouble with a validation rule requiring a Loss Reason from a Picklist to move to three different Close/Lost stages. I get no syntax errors but it doesn't stop me from moving to a closed stage. 

Formula:
AND (  
OR (
     ISPICKVAL(StageName, "Closed Lost"),
ISPICKVAL(StageName, "Closed – No Decision"),
     ISPICKVAL(StageName, "Closed – Retarget")),
ISPICKVAL(Loss_Reason__c,"none")
)

User-added image