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
Nam NguyenNam Nguyen 

Validation Rule help on multiple picklists

I can't figure out why this validation rule isn't working.  I want to make it so that if C4A or C4A Single-Channel is selected from my "Product" pick list, then the opportunity cannot move past the "Qualified" stage when "N/A" is selected from the "Product Engineer" picklist.  I also only want this to apply only to the record type "Sales".  But for some reason, when I apply this validation rule, I get the error message even when I'm in the Qualified stage.  

Here are the picklists I have, including what fields are available for each pick list:

Product:  C4A, C4A Single-Channel, C4N
Product Engineer:  N/A, (then multiple product engineers)
Opportunity Stages:  Qualified, Scoping/Presentation, Negotiation/Proposal, In Contract, Closed Won, Closed Lost
Record Type: Sales

Here is my validation rule:

And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel"),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal"))))
Best Answer chosen by Nam Nguyen
Dan1126Dan1126
Just by looking at this, I think you misplaced a closing parenthesis. It should be at the end of the first OR condition. 

So you need this:
And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel")),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal")))

Not this: 
And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel"),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal"))))



Let me know if that doesn't work!

All Answers

Dan1126Dan1126
Just by looking at this, I think you misplaced a closing parenthesis. It should be at the end of the first OR condition. 

So you need this:
And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel")),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal")))

Not this: 
And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel"),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal"))))



Let me know if that doesn't work!
This was selected as the best answer
Nam NguyenNam Nguyen
That worked!  I'm always missing a validation rule by one small comma or parenthesis.  Thanks Dan!