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
Marion SibbeMarion Sibbe 

validation rule - If one of the picklist vlaues is selected, another picklist will be mandatory

Hi all,

I need some help with a validation rule please. 

I have the picklist "Network" with 30 Values. For 20 of them it is necessary to enter another information in the picklist field "Payment". 

I tried different ways, but I was only able to relate one value to the the  2nd picklist. But this I also can not reproduce anymore. Can you help me? I played with  AND and OR ...but it won't work :(
Last try is: 
AND(
ISPICKVAL(network__c,"AD"),
ISPICKVAL (network__c,"AX"),
(ISBLANK(Payment_Type__c)))

In this case I got the Error "Error: Field Affiliate_Payment_Type__c is a picklist field. Picklist fields are only supported in certain functions. " But before it worked with the field. i have no idea..

 
Best Answer chosen by Marion Sibbe
Akhil AnilAkhil Anil
Hi Marion,

You need to use a CASE function when you have to compare multiple values against a single field. Your formula will be like this.
 
AND(
CASE(network__c,
"AD",1",
"AX",1",
0
) = 1,
ISBLANK(TEXT(Payment_Type__c))
)

You just have to enter the other 18 values in the same format that I used for the AD and AX values.

Kindly mark it as an answer if it works so that we can close the thread.

All Answers

Jim JamJim Jam
try..
OR(
ISPICKVAL(network__c,"AD"),
ISPICKVAL (network__c,"AX"),
AND (ISBLANK(Payment_Type__c)))
Jim JamJim Jam
OR(
ISPICKVAL(network__c,"AD"),
ISPICKVAL (network__c,"AX")),
AND (ISBLANK(Payment_Type__c))
Marion SibbeMarion Sibbe
I guess, I tried that before... I am recieving the error message: Field Payment_Type__c is a picklist field. Picklist fields are only supported in certain functions. 
 
Marion SibbeMarion Sibbe
I tried the second one and now I am getting 

Syntax error. Extra ','

If I delete it, i am getting 

Syntax error. Extra AND...

I don't get it :-o

 
Jim JamJim Jam
AND (ISBLANK(TEXT(Payment_Type__c)))
Jim JamJim Jam
OR(
ISPICKVAL(network__c,"AD"),
ISPICKVAL (network__c,"AX"))
AND (ISBLANK(TEXT(Payment_Type__c)))
Marion SibbeMarion Sibbe
nope. the same synthax errors :(
Akhil AnilAkhil Anil
Hi Marion,

You need to use a CASE function when you have to compare multiple values against a single field. Your formula will be like this.
 
AND(
CASE(network__c,
"AD",1",
"AX",1",
0
) = 1,
ISBLANK(TEXT(Payment_Type__c))
)

You just have to enter the other 18 values in the same format that I used for the AD and AX values.

Kindly mark it as an answer if it works so that we can close the thread.
This was selected as the best answer
Marion SibbeMarion Sibbe
Great, this is working :)

Thank you so much Akhil :)

1AND(
2CASE(network__c,
3"AD",1,
4"AX",1,
50
6) = 1,
7ISBLANK(TEXT(Payment_Type__c))
8)