Sharing Model
This content is for the 1.0 version. Switch to the latest version for up-to-date documentation.
Este conteúdo não está disponível em sua língua ainda.
Sharing Architecture
Section titled “Sharing Architecture”flowchart TB
subgraph SHARING["SHARING ARCHITECTURE"]
subgraph OTM["ObjectTeamMember__c"]
OTM1["OWD: Private"]
OTM2["Sharing: Custom via ObjectTeamMember__Share"]
OTM3["RowCause: ManualAccess__c"]
end
subgraph TSC["Team_Sharing_Config__c"]
TSC1["OWD: Public Read Only"]
TSC2["All users can read, admins modify"]
end
subgraph PARENT["Parent Objects<br/>(Account, Case, etc.)"]
P1["Requires: Private or Public Read Only OWD"]
P2["Sharing: Via [Object]Share"]
P3["RowCause: Manual"]
end
end
How Sharing Works
Section titled “How Sharing Works”ObjectTeamMember__c
Section titled “ObjectTeamMember__c”- OWD: Private
- Sharing mechanism: Custom sharing via
ObjectTeamMember__Share - RowCause:
ManualAccess__c
When a team member is added, the system creates an ObjectTeamMember__Share record so the team member can see their own team membership record.
Team_Sharing_Config__c
Section titled “Team_Sharing_Config__c”- OWD: Public Read Only
- All users can read configuration (needed for component rendering)
- Only administrators can modify configurations
Parent Objects
Section titled “Parent Objects”- Requirement: Objects must have Private or Public Read Only OWD
- Sharing mechanism: Via standard
[Object]Sharetables (e.g.,AccountShare,CaseShare) - RowCause: Manual
Access Level Mapping
Section titled “Access Level Mapping”When a team member is added with an access level, it maps to Salesforce share record access:
| ObjectTeamMember__c Access_Level__c | [Object]Share AccessLevel | Description |
|---|---|---|
| Read Only | Read | Team member can view the record |
| Read/Write | Edit | Team member can view and edit the record |
Share Record Lifecycle
Section titled “Share Record Lifecycle”Creating Shares
Section titled “Creating Shares”When a team member is added:
ObjectTeamMember__crecord is inserted- Trigger fires and enqueues
ShareRecordQueueable - Queueable creates two share records:
- Parent share:
[Object]Sharerecord giving the user access to the parent record - Team member share:
ObjectTeamMember__Sharerecord giving the user visibility of their team membership
- Parent share:
Updating Shares
Section titled “Updating Shares”When a team member’s access level changes:
ObjectTeamMember__crecord is updated- Trigger fires and enqueues
ShareRecordQueueable - Queueable deletes old share and creates new one with updated access level
Deleting Shares
Section titled “Deleting Shares”When a team member is removed:
ObjectTeamMember__crecord is deleted- Trigger fires and enqueues
ShareRecordQueueable - Queueable deletes both share records (parent and team member)
Bulk Recalculation
Section titled “Bulk Recalculation”When a sharing configuration is toggled:
- Deactivated:
SharingRecalculationBatchremoves all share records for that object - Reactivated:
SharingRecalculationBatchrecreates share records for all existing team members
Supported Share Objects
Section titled “Supported Share Objects”Standard Objects
Section titled “Standard Objects”| Object | Share Table |
|---|---|
| Account | AccountShare |
| Contact | ContactShare |
| Case | CaseShare |
| Lead | LeadShare |
| Opportunity | OpportunityShare |
| Campaign | CampaignShare |
| Order | OrderShare |
Custom Objects
Section titled “Custom Objects”Custom objects follow the pattern: ObjectName__c → ObjectName__Share
The system uses a hardcoded whitelist for standard objects and derives the share table name for custom objects automatically.
Deployment Requirements
Section titled “Deployment Requirements”Org Requirements
Section titled “Org Requirements”- Salesforce Enterprise Edition or higher (for sharing model support)
- Objects must have Private or Public Read Only OWD to benefit from sharing
User Requirements
Section titled “User Requirements”- Users need appropriate permission set assigned
- Users need base object access (e.g., Account read access to use Account teams)