Skip to main content
VTFriday

Salesforce Account Relationships: Hierarchies and Teams

Updated

Source: https://www.vtfriday.com/2026/11/salesforce-account-relationships.html

💬 In plain words: The Salesforce Account relationship toolkit solves three distinct problems with three purpose-built features. Account Hierarchies connect parent and subsidiary companies. Account Teams grant your internal co-workers record-level access to collaborate on an Account and its child records. Contacts to Multiple Accounts links a single external person—such as a consultant, physician, or board member—to several companies without duplicating their Contact record.
📌 Example: Dr. Rao is a cardiologist who practices at two hospital networks. Instead of cloning her Contact record for each hospital, enable Contacts to Multiple Accounts: set Apollo Hospital as her primary (direct) Account on Contact.AccountId, and add an indirect AccountContactRelation linking her to Fortis Hospital with the role Visiting Consultant. You maintain one person, one activity timeline, and two hospital affiliations.

🔑 Key Points

  • Separate data structure from record access: Account Hierarchies (ParentId) and Contacts to Multiple Accounts (AccountContactRelation) model external customer relationships, whereas Account Teams (AccountTeamMember) grant internal Salesforce users record visibility.
  • One direct Account, many indirect Accounts: With Contacts to Multiple Accounts enabled, a Contact still has exactly one primary Account (IsDirect = true) stored in Contact.AccountId, plus zero or more indirect Account links (IsDirect = false) stored as junction records.
  • Account Teams open up access; they never restrict it: Adding a user to an Account Team can grant Read Only or Read/Write access to the Account and its child Contacts, Opportunities, and Cases, but it cannot reduce access a user already receives from Organization-Wide Defaults (OWDs) or Sharing Rules.
  • Verify implicit sharing direction carefully: Salesforce's built-in Parent Implicit Sharing grants Read access to a parent Account when a user gets access to a child Contact, Opportunity, or Case. Conversely, Child Implicit Sharing (viewing child records just because you can view the parent Account) is controlled by the Account Owner's Role settings and the Account Team configuration—not granted unconditionally whenever child OWDs are set to Private.
  • Private Contacts are isolated by design: A Contact saved without a parent AccountId becomes a Private Contact, making it invisible to everyone except the record owner and users with View All Data permission.

💡 Concept: Choosing the Right Account Relationship Tool

When B2B data models grow messy in Salesforce, the root cause is usually that someone tried to solve a multi-company or multi-rep requirement using the wrong feature. Teams create duplicate Contact records when a buyer advises two subsidiaries, or they build broad criteria-based Sharing Rules just to let three specialists collaborate on one strategic customer.

To keep your schema clean, let's walk through the four relationship mechanisms that sit directly around the standard Account object and clarify what each one actually does under the hood.

Account Relationships & Visibility Overview
├─ Account Hierarchy ─────────────── Standard ParentId self-lookup → corporate tree (subsidiaries)
├─ Account Team ──────────────────── Internal users + Team Role + R/RW access to Account & child records
├─ Contacts to Multiple Accounts ─── 1 Contact ↔ Many Accounts via AccountContactRelation (1 Direct + N Indirect)
└─ Private Contact ───────────────── Contact with AccountId = null → visible to Owner & Administrators only

1. Account Hierarchy (Corporate Structure)

An Account Hierarchy links a child Business Account to a parent Business Account through the standard ParentId lookup field (labeled Parent Account in the UI). Clicking View Account Hierarchy on a record displays a tree of up to 2,000 related Accounts across parent, sibling, and subsidiary tiers.

Critically, linking two Accounts via ParentId is a visual and reporting relationship—it does not automatically roll up Opportunity revenue into standard fields on the parent Account, nor does owning a parent Account automatically grant a sales rep record access to child subsidiary Accounts when the Account OWD is Private (unless you configure Territory Management, Sharing Rules, or Apex sharing).

2. Account Teams (Internal Collaboration and Record Access)

In enterprise sales, a single Account Owner rarely works a customer alone; a Solutions Engineer, Customer Success Manager, and Executive Sponsor also need access. Available in Enterprise, Performance, Unlimited, and Developer Editions, Account Teams let the Account Owner (or users above them in the Role Hierarchy) add internal users as AccountTeamMember records on a specific Account.

Each team member receives a functional label (TeamMemberRole, such as Executive Sponsor) alongside explicit record-level sharing grants (written to the AccountShare table with RowCause = 'Team'):

  • Account Access: Read Only or Read/Write.
  • Contact Access: Private (none via the team), Read Only, or Read/Write (disabled if Contact OWD is Controlled by Parent, since Contact access then follows the Account automatically).
  • Opportunity Access: Private (none via the team), Read Only, or Read/Write.
  • Case Access: Private (none via the team), Read Only, or Read/Write.

Users can also configure a Default Account Team on their personal user record so their regular pod of co-workers can be added to new Accounts automatically or with one click.

3. Contacts to Multiple Accounts (External People Wearing Multiple Hats)

Out of the box, a Salesforce Contact has a single AccountId lookup. If an external IT consultant advises five of your clients, standard lookups force an uncomfortable choice: either link the consultant to only one client (hiding them from the other four) or create five duplicate Contact records (splitting their email history, campaign attribution, and phone updates across five rows).

Enabling Contacts to Multiple Accounts in Setup (Setup → Account Settings) exposes the standard junction object AccountContactRelation:

  • Direct Relationship (IsDirect = true): Automatically created and maintained by Salesforce whenever Contact.AccountId is populated. This represents the person's primary employer or home organization.
  • Indirect Relationships (IsDirect = false): Additional AccountContactRelation records linking that same Contact to other Accounts. Each junction record supports a multi-select picklist of Roles (for example, Board Member, Technical Advisor), StartDate, EndDate, an IsActive checkbox, and custom fields.

Note the distinction between AccountContactRelation and OpportunityContactRole: an AccountContactRelation defines who a person is to a company over time, whereas an OpportunityContactRole defines the role that person plays in evaluating a specific deal (such as Economic Buyer or Decision Maker).

4. Private Contacts (Orphaned Contacts)

If a user creates a Contact and leaves the AccountId field blank, Salesforce categorizes that record as a Private Contact. Regardless of your Contact Organization-Wide Defaults or Sharing Rules, a Private Contact is visible only to the record owner and system administrators (users with the View All Data or Modify All Data permission). Moreover, you cannot link a Private Contact to indirect Accounts via AccountContactRelation until you assign it a direct primary Account first.

🛠️ Worked Example: Linking an Existing Contact to a Secondary Client Account in Apex

Suppose your org has Contacts to Multiple Accounts enabled. A consultant is already stored in Salesforce with their consulting firm as their primary Account (Contact.AccountId), and you want to link them to a client Account with the role Technical Advisor without creating a duplicate Contact.

Prerequisites & Execution Context: "Allow users to relate a contact to multiple accounts" must be enabled in Account Settings. The running user requires Read access to the Contact and the target Account, plus Create/Edit permissions on relationships. Because this illustrative snippet has not been executed in your org, test it in a sandbox first.

public with sharing class AccountRelationshipService {

    public static Id linkConsultantToClientAccount(Id contactId, Id clientAccountId, String roleName) {
        if (contactId == null || clientAccountId == null) {
            throw new IllegalArgumentException('Both contactId and clientAccountId are required.');
        }

        // 1. Verify the Contact has a primary Account (Private Contacts cannot have indirect links)
        Contact con = [
            SELECT Id, AccountId
            FROM Contact
            WHERE Id = :contactId
            WITH USER_MODE
            LIMIT 1
        ];

        if (con.AccountId == null) {
            throw new DmlException('Cannot create an indirect relationship for a Private Contact (AccountId is null).');
        }

        // 2. Check if a direct or indirect relationship already exists for this pair
        List<AccountContactRelation> existingLinks = [
            SELECT Id, IsDirect, Roles, IsActive
            FROM AccountContactRelation
            WHERE ContactId = :contactId
              AND AccountId = :clientAccountId
            WITH USER_MODE
            LIMIT 1
        ];

        if (!existingLinks.isEmpty()) {
            AccountContactRelation existing = existingLinks[0];
            existing.Roles = roleName;
            existing.IsActive = true;
            update as user existing;
            return existing.Id;
        }

        // 3. Insert a new indirect AccountContactRelation (IsDirect defaults to false)
        AccountContactRelation indirectLink = new AccountContactRelation(
            ContactId = contactId,
            AccountId = clientAccountId,
            Roles = roleName,
            IsActive = true,
            StartDate = Date.today()
        );

        insert as user indirectLink;
        return indirectLink.Id;
    }
}

How to validate the expected result: Execute the method in a sandbox Anonymous Apex window passing a valid Contact ID and a secondary Account ID. Open the secondary Account record in Lightning Experience and inspect the Related Contacts related list: the consultant should appear with Direct unchecked and Roles set to Technical Advisor.

⚠️ Common Traps & Sharing Misconceptions
  • Confusing Parent Implicit Sharing with Child Implicit Sharing: Many candidates and admins state that "Read access to an Account always grants Read access to all its child Opportunities and Cases." That is only true if the child OWD is Controlled by Parent (available for Contact, not Opportunity or Case), or if the user receives access through an Account Team, Role Hierarchy setting, or Sharing Rule that includes children. When Opportunity OWD is set to Private, simply granting a user Read access to an Account via a Manual Share or an Account Sharing Rule with Opportunity Access set to Private (None) does not expose that Account's Opportunities. By contrast, Parent Implicit Sharing always works upward: if a user owns or is shared a child Opportunity, Case, or Contact, Salesforce implicitly grants them Read-Only access to the parent Account (AccountShare.RowCause = 'ImplicitChild').
  • Trying to delete a Direct AccountContactRelation record: If you try to run DELETE on an AccountContactRelation where IsDirect = true, Salesforce blocks the operation. To change a Contact's direct Account, update Contact.AccountId directly; Salesforce will automatically update or convert the underlying AccountContactRelation row depending on your Account Settings.
  • Assuming AccountContactRelation grants record sharing: Linking a Contact to a second Account via AccountContactRelation is purely a data-model junction. It does not grant the second Account's owner record access to a Private-OWD Contact owned by someone else unless sharing rules or Contact OWD allow it.
  • Modeling the corporate legal wall chart instead of buying centers: Creating a 7-level Account Hierarchy for holding shells that never sign contracts, log cases, or hold Opportunities slows down reporting and sharing recalculations without helping sales reps.
🧠 Account Access & Modeling Rule: OWD → Role Hierarchy → Sharing Rules → Account Team → Manual/Apex Share. Account Teams grant per-record internal access; Contacts to Multiple Accounts (AccountContactRelation) models external 1-to-many relationships without duplicating Contacts.
🧭 360 Card — Account Model & Relationships

Rule: Use Account Hierarchies for subsidiary corporate structures, Account Teams for internal per-account collaboration, and Contacts to Multiple Accounts for external people who work across several client organizations.
Gain: A single golden Contact record for an advisor working with five clients—preserving unified email logging, campaign history, and GDPR/privacy consent instead of scattering five duplicate Contacts across your database.
Price: Three distinct features to configure and govern, plus the temptation for business stakeholders to over-engineer deep Account Hierarchies that mirror legal tax entities rather than actual buying centers.
Limits: Every Contact still requires one primary direct Account (Contact.AccountId) before it can hold indirect relationships. Account Team grants apply record-by-record (or via Default Account Teams) rather than dynamically by field criteria.
Mirror — duplicating one Contact per Account: Simple to query with basic Contact.AccountId filters, but destroys your single view of the person and breaks marketing deduplication.
Later: A child Account earns its own record in a hierarchy only when it buys independently, receives support independently, and is measured independently.
At volume: Deep Account Hierarchies and massive Account Team changes trigger expensive sharing table recalculations—model the operational buying structure, not the corporate wall chart.

💬 Core Q&A

Q: A consultant works with five of your client companies. Your data model has one Contact per Account. How do you represent this cleanly?
🎯 Say this first: Enable Contacts to Multiple Accounts (AccountContactRelation)—keep one Contact record linked to one primary Account, and create indirect relationships with specific roles to the other four Accounts so you never duplicate the Contact.

A: Enable Contacts to Multiple Accounts (the AccountContactRelation junction object) in Account Settings.

  • How the data is structured: You maintain a single Contact record for the consultant. Their primary Account (Contact.AccountId, where IsDirect = true) points to their direct employer—or, if they are independent, their primary client—and four indirect AccountContactRelation rows (IsDirect = false) connect them to the remaining four client Accounts.
  • Role and lifecycle tracking: Each AccountContactRelation record stores its own Roles value (for example, IT Consultant at Client A and Steering Committee Member at Client B), along with StartDate, EndDate, and IsActive flags to track when the consultant joins or leaves an engagement.
  • Why duplicating the Contact fails: Cloning the Contact five times fractures the Activity Timeline, causes marketing automation tools to send five copies of the same email to the same address, and creates immediate data drift whenever the consultant changes their phone number.

🔍 Follow-ups (Scenario-Based)

Q1: Sales wants a small pod of reps to jointly own a strategic Account with different access levels. Sharing rules feel too broad. What do you use?

A1: Use an Account Team (AccountTeamMember).

  • Granular per-record access: On that specific strategic Account, the Account Owner adds each pod member, assigns their functional TeamMemberRole (such as Sales Engineer or Renewal Specialist), and configures their individual Read Only or Read/Write access for the Account itself, plus its related Contacts, Opportunities, and Cases.
  • Why Sharing Rules are the wrong tool here: Owner-based and criteria-based Sharing Rules evaluate across the entire object and require administrator deployment whenever ad-hoc pod assignments change. An Account Team grants access strictly to that single Account (and optionally its children) and can be managed directly by the Account Owner or automated via Default Account Teams and Apex/Flow.
Q2: A user has read access to an Account. Do they automatically see its Contacts and Opportunities?

A2: Not unconditionally—this is one of the most frequent misconceptions in Salesforce sharing investigations, and the answer depends on the child object's Organization-Wide Default (OWD) and how the user gained Account access:

  • When Contact OWD is Controlled by Parent: Yes for Contacts. Because Contact sharing is deferred to the parent Account, any user with Read access to the Account automatically sees its direct child Contacts (excluding Private Contacts, which have no Account).
  • When Contact, Opportunity, or Case OWD is Private: Simply having Read access to an Account (for example, via a Manual Share on the Account alone) does not automatically grant Read access to every private Opportunity or Case under that Account. Instead, child visibility depends on:
    1. Child Implicit Sharing on the Role Hierarchy: On each Role in Setup, administrators configure whether users in that Role (the Account Owner's role, shared upward to their managers) can view or edit all child Opportunities and Cases associated with Accounts they own, regardless of who owns the child Opportunity or Case.
    2. Sharing Rules and Account Teams: When you create an Account Sharing Rule or add an Account Team Member, you explicitly specify whether Opportunity and Case access is Private (None), Read Only, or Read/Write.
  • The reverse direction (Parent Implicit Sharing): Built-in implicit sharing always works upward. If a user is given Read or Read/Write access to a child Contact, Opportunity, or Case under a Private Account, Salesforce automatically grants them Read-Only access to the parent Account so the child record never appears with a broken parent lookup.
Q3 (Compare): An Account Hierarchy vs. one Account with many Contacts — when do child Accounts earn their place?

A3: Child Accounts earn their own records in an Account Hierarchy only when subsidiaries or regional branches operate as distinct commercial units:

  • Create child Accounts in a hierarchy when: Locations or subsidiaries sign separate legal contracts, have independent budgets and Opportunity pipelines, are owned by different territory reps, or have distinct billing/shipping addresses and service entitlements.
  • Keep a single Account with multiple Contacts (and AccountContactRelation) when: Corporate headquarters negotiates and pays for everything centrally, and internal departments are merely stakeholders on the same deals. Modeling internal departments as separate Accounts forces reps to guess which Account holds an Opportunity when they only needed Contact Roles.
Q4 (Next Concept Connection): When a user leaves the company or changes territories and you transfer ownership of a strategic Account to a new rep, what happens to the existing Account Team and Implicit Sharing records?

A4: When an Account's OwnerId changes, Salesforce recalculates built-in child/parent implicit shares for the old and new owners' role hierarchies automatically. For the Account Team, behavior depends on how the transfer is performed: in the UI, the user transferring the Account can choose whether to check Keep the account team; if unchecked (or during standard API owner updates unless preserved or re-inserted), non-preserved Account Team members and manual shares on the Account are removed, requiring Default Account Teams or automation to re-establish the new owner's pod.

📝 2-Minute Self-Check

Q1. A sales rep imports a spreadsheet of 200 conference leads as Contacts, forgets to map the AccountId column, and complains that nobody else on their sales team can see the Contacts even though Contact OWD is set to Public Read/Write. Why?
A1. Contacts without a parent AccountId become Private Contacts. Salesforce ignores the Contact Organization-Wide Default and Sharing Rules for Private Contacts, restricting visibility exclusively to the Contact owner and administrators with View All Data until an Account is populated.

Q2. A developer writes a trigger to delete an AccountContactRelation record when a Contact leaves a company, but the DML delete fails for one of the records. What flag caused the failure?
A2. The IsDirect flag (IsDirect = true). Salesforce does not allow deleting the direct AccountContactRelation row that mirrors Contact.AccountId; you must update Contact.AccountId on the Contact record instead.

Q3. Account and Opportunity OWDs are both Private. User A owns an Account, and User B owns a confidential Opportunity under User A's Account. Can User B view User A's Account?
A3. Yes, via built-in Parent Implicit Sharing (RowCause = 'ImplicitChild'). Whenever a user has access to a child Opportunity, Case, or Contact, Salesforce implicitly grants that user Read-Only access to the parent Account.

Was this article helpful?

Have a question or spotted a mistake? Ask here about this article

Found this guide useful? Buy me a coffee (opens in a new tab)

Comments

Questions, corrections and your own experience are all welcome.