Salesforce Security Programmatic Apex Sharing (in English)
Updated 2026-11-07
What's changed since the video
Each change is dated and checked against Salesforce's own documentation.
- Standard objects can have sharing reasons too. The video's sharing reason is on a custom object. Since Winter '27 (API version 68.0), standard objects can have them as well: "For standard objects, create them using the Metadata API or Tooling API," not in Classic (Sharing a Record Using Apex, same page). Before that, code on a standard object could only use Manual, and those shares went on an owner change (video 4.16).
Still right
- When the decision about who sees a record depends on its parents, linked records or something about the user, and the rules can't express it, code or a flow can write the shares.
- A share record has the record (the parent), the user or group, the access level and the row cause. A group or a territory as the target lets people move in and out instead of the shares.
- The share table doesn't hold everything: not View All or Modify All, and high-volume site users don't use it. A detail record in a master-detail relationship has no share table of its own.
- Use a sharing reason of your own, so you can tell your code's shares from everything else. "Apex managed sharing is maintained when the record owner changes or is deactivated" (Understanding Sharing, Apex Developer Guide, Winter '27, checked 2026-11-07).
- On a custom object, the sharing reason is still created in Salesforce Classic: "Apex sharing reasons aren't available in Lightning Experience" (Sharing a Record Using Apex, Apex Developer Guide, Winter '27, checked 2026-11-07).
- Everything you take on: the rules' criteria and where they live, changes to records, changes to users, a recalculation when the rules change, and the first large load.
All videos in this series: معمارية الأمان
لا يُحمَّل الفيديو من YouTube إلا عند النقر عليه.