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
Sean C.ax1056Sean C.ax1056 

VR to check that only one of three Check Boxes = TRUE?

Hi all

 

My minds not performing as well as it should today (late night :-) and grappling with this problem for about an hour and can't see a solution.

 

I have three check boxes (we'll say CheckBox1_c, CheckBox2_c and CheckBox3_c) that I need to validate that only 1 out of the 3 = TRUE and the rest are FALSE, but one must = TRUE, when the record is saved.

 

The error message to appear at the top of the page would be something like "You must choose at least one check box, and only one check box, in the XXXXXX Section. Please modify."

 

If anyone has any suggestions I'd really appreciate it.

 

Thanks,

Sean

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
venkat-Dvenkat-D

here you go..

 

(Private__c == true && (Public__c==true || both__c == true)) ||
(Public__c == true && (Private__c==true || both__c == true)) ||
(both__c == true && (Public__c==true || Private__c == true))

 

replace field names with your fields names

All Answers

venkat-Dvenkat-D

here you go..

 

(Private__c == true && (Public__c==true || both__c == true)) ||
(Public__c == true && (Private__c==true || both__c == true)) ||
(both__c == true && (Public__c==true || Private__c == true))

 

replace field names with your fields names

This was selected as the best answer
Sean C.ax1056Sean C.ax1056

PERFECT. Thanks Venky. You're a legend.

matermortsmatermorts
That's awesome! I had a similar need recently, except with only two checkboxes. I didn't feel like spending the mental energy to incorporate the validation into one rule, so I used two; one rule to fire if neither was checked and one to fire if both were checked. Now I think I'll go back and simplify my configuration with this.
Sean C.ax1056Sean C.ax1056

Yea very nice. I was that tired that I forgot it was 4 check boxes, not 3, but I just expanded it out to include the 4th.

 

Thanks again venky.