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
Tom FalconerTom Falconer 

I have 3 custom checkbox fields.I want to build a rule so that only one of these can be checked off at time (or saved that way to be more clear)

Any help would be appreciated
Best Answer chosen by Tom Falconer
Raj VakatiRaj Vakati
IF( 
OR(
AND(
Checkbox_Field_1=TRUE,
Checkbox_Field_2=FALSE , 
Checkbox_Field_3=FALSE , 
) , 
AND(
Checkbox_Field_1=FALSE,
Checkbox_Field_2=TRUE , 
Checkbox_Field_3=FALSE , 
) , 
AND(
Checkbox_Field_1=FALSE,
Checkbox_Field_2=FALSE , 
Checkbox_Field_3=TRUE , 
)) , TRUE ,FALSE )

 

All Answers

Raj VakatiRaj Vakati
IF( 
OR(
AND(
Checkbox_Field_1=TRUE,
Checkbox_Field_2=FALSE , 
Checkbox_Field_3=FALSE , 
) , 
AND(
Checkbox_Field_1=FALSE,
Checkbox_Field_2=TRUE , 
Checkbox_Field_3=FALSE , 
) , 
AND(
Checkbox_Field_1=FALSE,
Checkbox_Field_2=FALSE , 
Checkbox_Field_3=TRUE , 
)) , TRUE ,FALSE )

 
This was selected as the best answer
Tom FalconerTom Falconer
This is actually doing the opposite of what I want. I get an error when only one check box is selected or none. I'm only able to save a lead if multiple checkboxes are selected
Prince_sfdcPrince_sfdc
Hi Tom,
You may try this : 
If(donot_call__c&& (has_Email__c|| has_valid_fax__c) ,true, 
if(has_Email__c&& (donot_call__c|| has_valid_fax__c) , true, 
if(has_valid_fax__c&& (donot_call__c|| has_Email__c) , true,false)))
Here, I have 3 checkboxes , you may replace with yours. 
donot_call__c
has_Email__c
has_valid_fax__c

You should get the desired result. Please mark this as best answer if it resolves.
Sagar PatilSagar Patil
Hi Tom,

Kindly try below formula. This is working as per your requirement.
 
Case( 
       ( 
         If(API_NAME_OF_FIRST_CHECKBOX,"1","0")+ 
         If(API_NAME_OF_SECOND_CHECKBOX,"1","0")+ 
         If(API_NAME_OF_THIRD_CHECKBOX,"1","0") 
       ), 
 
          "100", 1, 
          "010", 1, 
          "001", 1, 
           0 
      )=0

Kindly mark this as a best answer if it solves your problem. It will help others to refer for similar kind of requirements.

Regards,
Sagar
Tom FalconerTom Falconer
Validation rule from Raj V works, you just have to reverse the true and false at the end