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
Alex MakkAlex Makk 

Account validation rules with related contacts.

Hi! I have 2 validation rules that kinda similar but different.

First: I have 2 custom checkboxes on "Contact" object, and I'd like to write a validation rule that will check if at least one of the child records have those checkboxes. It can be one out of two for each contact.

I was guessing that rollup summary fields can help me out. I will have a validation where I can't save record if checkbox count can't be less than 1 for this account..
ISPICKVAL( Type , "Customer"),
Primary_Contact__r.Number_field1__c < 1 || Primary_Contact__r.Number_field2__c < 1

Second validation: Account need to have at least 3 related contacts, and these contacts have to have their Contact Roles (Custom Picklist Field). 

Contact2 -> Picklist_value1
​Contact2 -> Picklist_value2
​Contact3 -> Picklist_value3

I shouldn't be able to save Account record if one of the (Picklist_value) are missing on one of the related contacts. As far as I know, I can't setup roll-up summary to picklist field..

Any help on that approceiated. Thanks!
Alex MakkAlex Makk