Print this page

Validation Rule to prevent selection of multiple checkboxes

Knowledge Article Number 000004567
Description

We have a set of checkbox fields on an object, and only 2 should be selected at any given time. How can we write a rule to enforce that no more than 2 of these checkboxes may be selected?

Resolution

To achieve the described results, you can add up the number of selected checkboxes and return an error if this is greater than 2. For example:

(IF ( Checkbox_1__c, 1, 0) + IF ( Checkbox_2__c, 1, 0) + IF ( Checkbox_3__c, 1, 0)) > 2

 





promote demote