Source: https://www.vtfriday.com/2026/12/salesforce-sharing-sets-and-share.html
⚡ Key Points
- High-volume Experience Cloud licenses (like basic Customer Community) skip
UserRolerecords and__Sharetable rows on purpose so Salesforce can scale to millions of external users without role recalculation stalls. - A Sharing Set checks an Access Mapping at runtime and grants Read or Read/Write access whenever a lookup field on the target record matches the logged-in user's Contact or Account.
- Because role-less portal users sit outside the Role Hierarchy, records they create and own do not roll up to internal managers when Internal Organization-Wide Defaults (OWDs) are Private. Activating a Share Group opens those portal-owned records back up to internal roles, territories, or public groups.
- For any single Profile, you can only configure one access mapping per object across your Sharing Sets, and that Profile (or an assigned Permission Set) still needs at least Read CRUD permission on the object for the Sharing Set to work.
🧱 How Sharing Sets and Share Groups Work Under the Hood
Inside a standard Salesforce org (Enterprise, Performance, Unlimited, or Developer Edition with Digital Experiences enabled), record sharing starts with Organization-Wide Defaults (OWDs) and opens up through the Role Hierarchy and Sharing Rules. Every time a record changes owners or a role moves, Salesforce recalculates physical rows in the object's share table (like CaseShare or CustomObject__Share).
1. Sharing Sets (Opening Records to the Portal User)
When you create high-volume external users on Customer Community, High Volume Customer Portal, or Authenticated Website licenses, Salesforce gives them no roles and writes no standard __Share rows for them. Instead, each external User record points directly to a CRM Contact (which belongs to an Account, or sits inside a Person Account).
A Sharing Set connects that user record to your CRM data through an Access Mapping made of two fields:
- The User Field:
User:Contact,User:Account, or a one-hop lookup off the User's Contact or Account (such asUser:Account.Parent). - The Target Object Field: a lookup or master-detail field on the target object (
Case,Order,WorkOrder, or a Custom Object) pointing to an Account or Contact, likeCase:AccountIdorCase:ContactId.
When a portal user named Rahul logs in and opens a Case list view, Salesforce checks whether User.AccountId = Case.AccountId. If they match, Rahul gets the Read or Read/Write access configured in the Sharing Set. Teammates at Rahul's company who share that same AccountId see the exact same Cases, while users from any other customer Account see nothing.
2. Share Groups (Opening Portal-Owned Records Back to Internal Staff)
Now flip the direction. Suppose a high-volume portal user creates a custom record (like Warranty_Claim__c) or logs a Case without a Case Assignment Rule changing the owner. By default, that portal user stays the OwnerId. When Internal OWD is Private, normal internal Role Hierarchy rollups do nothing because the portal user has no role, and standard owner-based Sharing Rules cannot target high-volume portal users.
That is what a Share Group fixes. Every Sharing Set has a companion Share Group Settings tab. Once you activate the Share Group and add internal Roles, Role and Internal Subordinates, Public Groups, Territories, or specific internal Users, Salesforce automatically grants those internal staff members Read/Write access to every record owned by high-volume portal users covered by that Sharing Set.
This comes up constantly on new support portals: external customers submit Cases on an Experience Cloud site, and internal support agents open their queues only to see nothing there.
- The Symptom: High-volume Customer Community users log Cases online and can see their own tickets through a Sharing Set. Internal support agents (with Internal OWD on
Caseset to Private and no Case Assignment Rule moving ownership to a queue) cannot see those new Cases at all. - The Bad Fix: Under pressure to unblock the helpdesk, someone checks View All on
Casein the internal Support Agent Profile. The missing Cases pop up right away, and now every support agent can also read confidential VIP, legal, and HR Cases across the entire org. - The Root Cause: The portal user remained the
OwnerId, and basic Customer Community users have no role, so the record never rolled up the Role Hierarchy and matched no role-based Sharing Rule. - The Fix: Leave View All unchecked. Either turn on an active Case Assignment Rule so portal Cases immediately transfer to an internal Support Queue, or activate the Share Group on the portal's Sharing Set and add the internal Customer Support Role or Public Group.
- The Outcome: Support agents see only the portal tickets they are supposed to work, while sensitive internal Cases stay locked down.
- Rule: Use Sharing Sets to give high-volume portal users access to records linked to their Account or Contact; use Share Groups (or queue assignment) to open records owned by those users back to internal teams.
- Benefit: Gives millions of external users clean, account-isolated record access without generating millions of
__Sharetable rows or hitting org role limits. - Tradeoff: Sharing Sets only match lookup relationships (Account or Contact IDs). They cannot filter by text, picklist, or numeric fields the way a criteria-based Sharing Rule does.
- Limits: Works only on supported standard objects (such as Case, Order, WorkOrder, ServiceContract) and Custom Objects that have an Account or Contact lookup. Cannot create a manager-over-rep hierarchy inside one customer Account without either separate profiles or upgrading to Customer Community Plus.
🛠️ Worked Example: Configuring and Deploying a Sharing Set
Say you are setting up an equipment portal where high-volume Customer Community users need Read/Write access to any Case under their company's Account, plus Read-Only access to Asset__c (a custom object tracking installed equipment) linked to their Account.
Prerequisites and Setup Steps
- In Setup > Sharing Settings, confirm Default External Access for
Account,Contact,Case, andAsset__cis set to Private. - Open the custom Customer Community User profile (or an assigned Permission Set) and make sure it grants at least Read, Create, and Edit on
Caseand Read onAsset__c. A Sharing Set opens record-level sharing, never missing object CRUD. - Go to Setup > Digital Experiences > Settings and scroll to Sharing Sets. Click New, select the Customer Community User profile, add
CaseandAsset__cto Selected Objects, and click Set Up beside each object to configure its Access Mapping. - On the Sharing Set detail page, open the Share Group Settings tab, click Activate, and add your internal Support Engineers Public Group so internal staff can see records created and owned by portal users.
If your team tracks Experience Cloud config in Git and deploys with Salesforce CLI, Sharing Sets live in SharingSet metadata (.sharingSet-meta.xml). Here is an illustrative metadata excerpt matching the two mappings above. Deploying it requires an existing Custom Customer Community profile and an Asset__c object with an Account__c lookup field, and you should test it in a sandbox first:
<?xml version="1.0" encoding="UTF-8"?>
<SharingSet xmlns="http://soap.sforce.com/2006/04/metadata">
<description>Grants portal users access to their company Cases and Assets.</description>
<name>Customer_Account_Portal_Access</name>
<profiles>custom customer community</profiles>
<accessMappings>
<accessLevel>Edit</accessLevel>
<object>Case</object>
<objectField>Account</objectField>
<userField>Account</userField>
</accessMappings>
<accessMappings>
<accessLevel>Read</accessLevel>
<object>Asset__c</object>
<objectField>Account__c</objectField>
<userField>Account</userField>
</accessMappings>
</SharingSet>
Here, <userField>Account</userField> pulls the logged-in portal user's Account ID and compares it against <objectField>Account__c</objectField> on Asset__c. If you wanted each user to see only the Cases they personally logged instead of their whole company's Cases, you would change both userField and objectField on the Case mapping from Account to Contact.
- Check cross-company isolation in a sandbox: create two Accounts (Acme Corp and Global Tech). Under Acme Corp, create two portal users (Rahul and Priya) and a Case linked to Acme Corp. Under Global Tech, create one Case. Log in as Priya, confirm she can view and edit Rahul's Acme Corp Case, and paste the 18-character ID of the Global Tech Case into the portal URL to confirm she gets an access error.
- Check internal visibility: while logged in as Rahul, insert a custom record owned by Rahul. Log in as an internal Support Engineer who does not have "View All" or "Modify All Data" and confirm the record shows up via the active Share Group.
⚠️ Common Mistakes and Interview Traps
⚠ INTERVIEW TRAP: A record owned by a high-volume portal user never rolls up through the internal Role Hierarchy. Giving internal agents View All on the object is a dangerous shortcut. Use a Share Group (or reassign ownership to an internal Queue) instead.
- Marking a portal Apex controller
without sharingjust because a user could not see records in an LWC. Runningwithout sharingignores record-level security completely, so one missingWHERE AccountId = :userAccountIdfilter leaks every customer's data. Keep portal Apex controllerswith sharing(orinherited sharing) and let the Sharing Set handle row-level access. - Forgetting that Sharing Sets attach to Profiles, not Permission Sets. Even if your org follows a Permission Set-led model for object CRUD and FLS, the user's base Profile still has to be listed in the Sharing Set's Selected Profiles box.
- Leaving the Account or Contact lookup blank on target records. A mapping on
User:Account = Case:AccountIdonly matches whenCase.AccountIdis populated. If an integration or web form inserts a Case with a blankAccountId, the portal user will never see it. - Trying to filter a Sharing Set by Status or Record Type. Sharing Sets do not support field filters like
Status != 'Draft'. If the Account lookup matches on a draft record, the portal user can see it. Keep the Account lookup blank until the record is ready to publish, or move to a role-bearing license that supports criteria-based Sharing Rules.
❓ Core Questions & Scenario Walkthroughs
User:Account = Case:Account. Basic Customer Community users have no roles, so a Sharing Set is the lookup-based replacement for standard sharing rules.
A: Keep External OWD on Case and Account set to Private so customers have zero cross-account visibility by default. Then go to Setup > Digital Experiences > Settings, create a Sharing Set for the Customer Community profile, add Case, and map User:Account = Case:Account with Read or Read/Write access.
At login, Salesforce follows the portal user's Contact to their AccountId and opens only the Cases carrying that exact AccountId. Because high-volume Customer Community users have no roles, standard Sharing Rules cannot target them at all.
A1: A Sharing Set handles flat company-wide visibility right out of the box, but it cannot build a manager-over-rep hierarchy inside one single Profile:
- For flat account-wide visibility, map
User:Account = Case:Account. Every portal user under that Account sees all Cases for that company, including Cases logged by coworkers. - For individual-only visibility, map
User:Contact = Case:Contactso each employee sees only the Cases where they are the Contact. - For a manager-sees-all, rep-sees-own split, you have two choices: clone a second high-volume Profile for managers and assign it a separate Sharing Set mapped on
User:Account = Case:Account(while regular employees stay on aUser:Contact = Case:Contactprofile), or upgrade to Customer Community Plus or Partner Community licenses to get real portal Roles (Executive, Manager, User) and Super User Access.
A2: Activate the Share Group on your Sharing Set, or transfer record ownership when the record is created:
- This happens because Internal OWD is Private and the high-volume portal user who owns the record has no role in the internal Role Hierarchy.
- Option 1 (Share Groups): Open the Share Group Settings tab on the Sharing Set, activate it, and add the internal Support Role, Public Group, or Territory. Those internal users automatically get access to records owned by high-volume users in that Sharing Set.
- Option 2 (Ownership Reassignment): On
Case, run an active Case Assignment Rule (or a Record-Triggered Flow on custom objects) that movesOwnerIdto an internal Support Queue or the internal Account Owner right on insert. Once an internal Queue or role-bearing user owns the record, normal internal sharing takes over.
A3: Standard Sharing Rules (owner-based and criteria-based) depend on the Role Hierarchy, Public Groups, and physical __Share table rows recalculated whenever records or groups change. That scales fine for thousands of employees or Partner users, but keeping roles and share tables updated for millions of B2C customers would drag database performance down hard.
Sharing Sets avoid that overhead by skipping roles and share tables completely. Instead of pre-calculating group memberships, Salesforce checks a direct relational lookup (Account or Contact) for the logged-in user. Use Sharing Rules for internal users and role-bearing external licenses (Customer Community Plus and Partner Community); use Sharing Sets and Share Groups for role-less Customer Community users.
Order where User:Account = Order:Account. When a test portal user logs in, they can see their company's Orders, yet the Edit button is missing and updates fail. What is the most likely cause?Answer & Explanation: The portal user's Profile (and assigned Permission Sets) only has Read object permission on
Order, not Edit. A Sharing Set controls record-level access, but it can never grant Edit ability beyond what the user's object-level CRUD permissions allow.
A: Unauthenticated visitors cannot use Sharing Sets at all because the Site Guest User is one shared anonymous account with no customer Account or Contact linked to it. Under Salesforce's mandatory Secure guest user record access enforcement, Guest User OWD is permanently locked to Private on every object, and guests cannot join Public Groups, Queues, or standard owner-based Sharing Rules.
To let anonymous visitors read specific public records (like published catalog items or announcements), create a Guest User Sharing Rule, which is a criteria-based rule granting strictly Read Only access when records match tight criteria (such as Is_Public__c = TRUE). Any record a guest submits is also routed immediately to a default internal owner so anonymous visitors never own records or read back private submissions.
Comments
Questions, corrections and your own experience are all welcome.
Post a Comment