Loading
Sales Basics
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Validation Rules for Account Contact Relationships

          Validation Rules for Account Contact Relationships

          If your org uses Contacts to Multiple Accounts and you’ve created validation rules for the Account Contact Relationship object, you must bypass those validation rules in some cases.

          Required Editions

          Available in: both Salesforce Classic and Lightning Experience
          Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions

          When a contact with a related account is created, a direct Account Contact Relationship record is also created. Similarly, when a contact gets a new primary account, the current direct Account Contact Relationship record is modified. Validation rules for the Account Contact Relationship are run immediately after the contact is saved to the database.

          Because the Account Contact Relationship records are created behind the scenes and users can’t access the Account Contact Relationship fields when creating or editing a contact, validation rules can block the contact from being saved.

          For example, the following Account Contact Relationship validation rule requires a value for the Roles field.

          ISNULL(Roles)

          However, a user can’t access the Roles field on the Account Contact Relationship object when creating or editing the contact. Therefore, the criteria in the validation rule can’t be met, and the contact can’t be saved.

          To bypass the validation rule when a direct Account Contact Relationship is created, add the following syntax to your Account Contact Relationship validation rule.

          (NOT (ISNEW() && IsDirect)) && (NOT ISCHANGED(IsDirect))

          Now, the Account Contact Relationship validation rule states that the Roles field is required only if the Account Contact Relationship isn’t a direct relationship.

          (NOT (ISNEW() && IsDirect)) && (NOT ISCHANGED(IsDirect))
          &&
          ISNULL(Roles)
           
          Loading
          Salesforce Help | Article