What is Apex Managed Sharing and when is it needed?
Suggested answer
Apex Managed Sharing is used when sharing requirements are too complex for declarative sharing rules. Each custom object has a corresponding Share object (e.g., MyObject__Share). An Apex class (typically a trigger or batch job) creates records in this Share object to grant specific users or groups access to specific records. Key fields on the Share object: ParentId (the record being shared), UserOrGroupId (who receives access), AccessLevel (Read or Edit), RowCause (must be a custom sharing reason created in Setup — this differentiates Apex Managed Sharing from manual sharing and prevents deletion during sharing recalculation). Apex Managed Sharing rows with custom row causes persist through sharing recalculations.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.