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
The Repair Depot AdminThe Repair Depot Admin 

Rule Preventing A Picklist Value Based on Checkbox

I have created a custom object named "Work Order". In this, I have a picklist field, "Reason on Hold", that has "Deductible Hold" as a value. I also have a checkbox field of "Pays with PO" in the same custom object. I would like to create a validation rule preventing the "Reason on Hold" field from having "Deductible Hold" entered, if the checkbox field of "Pays with PO" is checked. Can anyone offer any insight? It would be much appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
Kent ManningKent Manning
I would try this formula:

Pays_with_PO__c && Contains (Reason_on_hold__c, "Deductible Hold")

Message: "Cannot select Deductible Hold if the pays with PO box is checked"

All Answers

Kent ManningKent Manning
I would try this formula:

Pays_with_PO__c && Contains (Reason_on_hold__c, "Deductible Hold")

Message: "Cannot select Deductible Hold if the pays with PO box is checked"

This was selected as the best answer
The Repair Depot AdminThe Repair Depot Admin

I had to modify the formula slightly to the following:

 

Pays_with_PO__c && ISPICKVAL (Reason_On_Hold__c, "Deductible")

 

 

I appreciate your insight! I don't have much experience in building validation formulas, and greatly appreciate your assistance.

Kent ManningKent Manning
That is not a problem.
Glad I could help.

Since the "Pays with PO" is a Boolean field and the ISPICKVAL is a logical function, it's very easy to write a validation rule. By ANDing the two together you are checking both conditions and presenting the error if they are both true.

Let me know if I can help further.