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
nickfs92840nickfs92840 

Picklist Validation

Need a validation rule where there are multiple picklist items in one field (e.g. Field_1__c) and multiple items in the second picklist (e.g. Field_2__c).

 

Lets say user selects YES from "Field_1__c" picklist, the user must select "Does Not Apply" from "Field_2__c".

 

If user selects another selection from "Field_2__c" that is not "Does Not Apply", the user will be prompted to make the correct selection via the error message.

 

Thank you in advance!

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,


Youe validation rule should be like this


ISPICKVAL( Field_1__c , 'Yes') && NOT( ISPICKVAL( Field_2__c , 'Does Not Apply'))


And make your own error message. I have taken Error message as “You must have to select 'Does Not Apply' when you are selecting yes from field1.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,


Youe validation rule should be like this


ISPICKVAL( Field_1__c , 'Yes') && NOT( ISPICKVAL( Field_2__c , 'Does Not Apply'))


And make your own error message. I have taken Error message as “You must have to select 'Does Not Apply' when you are selecting yes from field1.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
nickfs92840nickfs92840

After reviewing, when I check the syntax, I receive  no errors, but the rule does not execute when in a live record.

Steve :-/Steve :-/

I would check the spelling an punctuation of the values in your formula and the picklists, they have to match EXACTLY; spelling , upper-lower case, blank spaces, everything...

nickfs92840nickfs92840

its good to go! I had removed the blank spaces fromNavatar's formula, so it is good to go! Also, thanks Stevemo!