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
TigerPowerTigerPower 

checkbox validation rule

Hey,

how about this one?!

 

If 'Male' checkbox is checked then 'Female' checkbox has to be unchecked. How do I write a validation rule for that? And of course this goes both ways, so only one sex can be checked :smileyhappy:

 

Can you please help me with this one? 

Thank You!

 

Best Answer chosen by Admin (Salesforce Developers) 
TigerPowerTigerPower

IF(Male_c, Female_c, null)

How simple is that? Very! 

 

Stevemo... thanks! :smileywink:

 

 

All Answers

Steve :-/Steve :-/

The formula to evaluate a Checkbox Field is

 

 

IF({!CheckboxField}, value_if_true, value_if_false)

 

 But why bother having 2 seperate checkbox fields in the first place?  Wouldn't you be better off using one single value picklist (Gender) field?

 

 

TigerPowerTigerPower

Well, customer prefers checkboxes. We had first a picklist, but they think that checking a checkbox is easier to do.

 

Maybe I'm missing something, but I think that you can't validate two checkboxes against each other with that syntax. Or can it be that simple (or maybe I am...) :smileysurprised:

 

 

Steve :-/Steve :-/

(sorry, my bad)

 

I was just using that as an example of a simple Checkbox validation.  For what you want to do, you'll have to amend it to compare the 2 fields.

 

 

 

PS.  I'm resisting the urge to comment on your customers  *difficulty* using a Single Value Picklist

TigerPowerTigerPower

Yeah :smileyvery-happy:

 

Life is. Some kind of difficult (sometimes).

 

 

Steve :-/Steve :-/
Unfrozen Caveman SalesforceUser "Your wordy picklist thing confuses and frightens me..."
TigerPowerTigerPower

IF(Male_c, Female_c, null)

How simple is that? Very! 

 

Stevemo... thanks! :smileywink:

 

 

This was selected as the best answer
pankaj.kumar@sfd.compankaj.kumar@sfd.com

Hi,

  can you send me steps of that validation.

 

thanks 

pankaj