# Apex managed sharing, share objects and sharing reasons

*Platform Sharing and Visibility Architect Study Guide · Access to Records · Last updated October 26, 2026 · https://www.certifyforce.com/study-guide/platform-sharing-and-visibility-architect/access-to-records/apex-managed-sharing-share-objects-and-sharing-reasons*

When code is the right way to share records and when a declarative tool already fits, what a share object stores (and what it never stores), how row causes decide who can change a share and whether it survives an owner change, and how recalculation keeps Apex shares correct.

- Certification: Salesforce Platform Sharing and Visibility Architect
- Exam section: Access to Records
- Study guide: https://www.certifyforce.com/study-guide/platform-sharing-and-visibility-architect

**Official exam objective:**

> Given a set of conditions, determine how programmatic sharing supports the record access requirements.

## What the exam expects

- Decide when a requirement needs programmatic sharing and when a sharing rule, guest user sharing rule or team already meets it.
- Read a share object: its fields, access levels and what it never records.
- Choose the Manual row cause or an Apex sharing reason, and predict each on an owner or default change.
- Plan recalculation and the constraints Apex shares put on the default.
- Predict how the surrounding class's sharing keyword changes the result, with the API version stated.

Key terms: **share object** (an object's access-control table, such as `Job__Share`); **RowCause** (why a share row exists, shown as Reason); **Apex sharing reason** (a developer-defined RowCause on a custom object); **Apex managed sharing** (shares written by code with an Apex sharing reason); **recalculation class** (a batch class that rebuilds Apex shares).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Detail side of master-detail | No share object | [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm) |
| Not in share objects | Default, role hierarchy, View All/Modify All Records, View All/Modify All Data | [Understanding Sharing](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_understanding.htm) |
| Grantable levels | Read or Edit, above the default; All is internal | [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm) |
| Read-only fields | ParentId, UserOrGroupId, RowCause | [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm) |
| Default RowCause from Apex | Manual; deleted on owner change | [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm) |
| Apex sharing reason | Custom objects only; kept on owner change; created in Classic | [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm) |
| Changing Apex managed shares | Modify All Data only | [Understanding Sharing](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_understanding.htm) |
| Guest users | No Apex or manual shares; guest user sharing rules only | [Secure Guest Users’ Sharing](https://help.salesforce.com/s/articleView?id=platform.networks_secure_guest_user_sharing.htm&language=en_US&type=5) |
| Default change | Redundant shares removed; recalculation classes run | [Recalculating Apex Sharing](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_recalc.htm) |
| Default lock | Private can't go public while Apex uses the share entries | [Internal Sharing Defaults](https://help.salesforce.com/s/articleView?id=platform.admin_sharing.htm&language=en_US&type=5) |

## Check yourself

- Why does an `AccountShare` export understate who can see accounts?
- When does Salesforce run an object's Apex recalculation class without anyone clicking it?
- Why can't a public site show records to visitors through a trigger that writes share rows?
- Where is an Apex sharing reason created?

## Sources

- [Sharing a Record Using Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm)
- [Understanding Sharing](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_understanding.htm)
- [Recalculating Apex Managed Sharing](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_recalc.htm)
- [Platform Sharing Architecture](https://architect.salesforce.com/docs/architect/fundamentals/guide/platform-sharing-architecture)
- [Sharing Rules](https://help.salesforce.com/s/articleView?id=platform.security_about_sharing_rules.htm&language=en_US&type=5)
- [Secure Guest Users’ Sharing Settings and Record Access](https://help.salesforce.com/s/articleView?id=platform.networks_secure_guest_user_sharing.htm&language=en_US&type=5)
- [Set Your Internal Organization-Wide Sharing Defaults](https://help.salesforce.com/s/articleView?id=platform.admin_sharing.htm&language=en_US&type=5)
- [Use the with sharing, without sharing, and inherited sharing Keywords](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm)
- [Enforce Sharing Rules](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_security_sharing_rules.htm)
- [Database Operations Run in User Mode by Default, Not System Mode](https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_default_user_mode.htm&release=262&type=5)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 13 linked practice questions, and unlimited timed mock exams are included with the Platform Sharing and Visibility Architect pack (USD $19): https://www.certifyforce.com/practice-exams
