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
KimberlyJKimberlyJ 

Validation Rule with picklist values

The formula below requires certain picklists to be populated based on dollar values in corresponding fields.  This works for all departments.  I added the red section because I want to filter in two departments that have to obey this validation rule.  When I added the 3 red lines I no longer received error messages when I was supposed to.  I only want Networks and Distribution to have to follow this validation rule.  What am I missing?

 

Thanks.

 


AND(
DATEVALUE(CreatedDate) > DATE(2012,8,23),
AND(
ISPICKVAL( CCI_Division_Region__c , "CCI Networks"),
ISPICKVAL( CCI_Division_Region__c , "CCI Distribution"),
OR(
AND(Services__c > 0,
ISBLANK(TEXT(Product__c )),
ISBLANK(Services_Product_Involved__c)),
AND(Support__c > 0,
ISBLANK(Support_Provider__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c))))))

Best Answer chosen by Admin (Salesforce Developers) 
MarcPannenberg.ax1843MarcPannenberg.ax1843

You want to add an OR here. Otherwise the picklist would have to have both values at the same time, in order to evaluate to true.

 

AND(
DATEVALUE(CreatedDate) > DATE(2012,8,23),
AND(

OR(
ISPICKVAL( CCI_Division_Region__c , "CCI Networks"),
ISPICKVAL( CCI_Division_Region__c , "CCI Distribution")),
OR(
AND(Services__c > 0,
ISBLANK(TEXT(Product__c )),
ISBLANK(Services_Product_Involved__c)),
AND(Support__c > 0,
ISBLANK(Support_Provider__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c))))))

All Answers

MarcPannenberg.ax1843MarcPannenberg.ax1843

You want to add an OR here. Otherwise the picklist would have to have both values at the same time, in order to evaluate to true.

 

AND(
DATEVALUE(CreatedDate) > DATE(2012,8,23),
AND(

OR(
ISPICKVAL( CCI_Division_Region__c , "CCI Networks"),
ISPICKVAL( CCI_Division_Region__c , "CCI Distribution")),
OR(
AND(Services__c > 0,
ISBLANK(TEXT(Product__c )),
ISBLANK(Services_Product_Involved__c)),
AND(Support__c > 0,
ISBLANK(Support_Provider__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c))))))

This was selected as the best answer
Amit Jha 20Amit Jha 20
use it,It will run
if(IsEscalated,if(ispickval(Priority,'Low'),true,if(ispickval(Priority,'Medium'),true,false)),false)