[SalesForce] Incorporate Record type name on validation rule formula

I am trying to create a formula that restricts multiple checkboxes from being ticked. User should only be able to tick one checkbox per record. I've managed to create the formula that handles this functionality but I cannot seem to figure out how to add a specific record type for it. Here's what I've Got so far

IF (Lighting_Only__c , 1, 0) + 
IF ( Accessories_Only__c , 1, 0) + 
IF ( Accessories_Small_Furniture__c , 1, 0) +
IF ( All_Product_Categories__c , 1, 0)) > 1

Can anyone help assist me adding the $recordtype name = 'Dealer' on above formula?

Best Answer

Besides summig the result of the field checks, you could add an AND operator to check for the record type:

RecordType.DeveloperName == 'Dealer'

This way, when the record type is "dealer" and one of the fields is ticked, your validation rule should be triggered.

Also, you should consider getting those fields transformed into a picklist field, since only one of them can be ticket at the same time. This kinda looks like the behavior for a picklist field.

Related Topic