Evaluate two picklist values against a separate picklist for validation rule

opportunityvalidation-rule

I'm hoping someone on here will be able to help me troubleshoot a formula construction for a validation rule I'm trying to implement on our Opportunity object.

Essentially I want the validation rule to fire if a user tries to save an opportunity record that they have indicated has had SDR involvement, but they haven't completed the 'Sales Development Rep' field.

The first picklist field I want to check against is one called 'Inbound vs Self Generated'. There are two picklist values I'm wanting to evaluate here. These are:

'SDR Generated' and 'SDR/BDM Collaboration'.

User should not be able to save record if any of these values are present, and the second picklist 'Sales Development Rep' is blank.

I have tried several different constructions, but I cannot find a way to evaluate both picklist values from the 'Inbound vs Self Generated' picklist. Here's what I've tried:

OR(
ISPICKVAL( Inbound_vs_Self_Generated__c , "SDR Generated") ,
( ISPICKVAL( Inbound_vs_Self_Generated__c , "SDR/BDM Collaboration")),
AND( ISPICKVAL( Sales_Development_Rep__c, "" )))

The above doesn't give me a syntax error, but when I try to test it, its throwing the validation error on all the picklist values, and not only the two I want it to.

Can someone help please? I've built a formula to evaluate one value only and that works fine. See below:

AND( ISPICKVAL( Inbound_vs_Self_Generated__c , "SDR Generated") ,
ISPICKVAL( Sales_Development_Rep__c , ""))

That one works fine – I can't work out how to replicate this so that it can evaluate my second picklist value as well.

Best Answer

Try with below formula.

AND( OR(ISPICKVAL( Inbound_vs_Self_Generated__c , "SDR Generated") , 
        ISPICKVAL( Inbound_vs_Self_Generated__c , "SDR/BDM Collaboration")),
     ISPICKVAL( Sales_Development_Rep__c , ""))

OR operator checks the Inbound_vs_Self_Generated__c field have "SDR Generated"/"SDR/BDM Collaboration"

AND operator check both(Inbound_vs_Self_Generated__c field should have anyone value and the same time it will check the Sales_Development_Rep__c should not be null) condition are true the it will fire the validation

Related Topic