PDII practice question 7 of 10

Universal Containers implements a private sharing model for the Convention Attendee co custom object. As part of a new quality assurance effort, the…

Full set: 198 questions
Universal Containers implements a private sharing model for the Convention Attendee co custom object. As part of a new quality assurance effort, the company created an Event_Reviewer_c user lookup field on the object. Management wants the event reviewer to automatically gain ReadWrite access to every record they are assigned to. What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record?
Answer options
A: Create a before insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
B: Create an after insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing. Correct answer
C: Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers,
D: Create a criteria-based sharing rule on the Convention Attendee custom object to share the records with a group of Event Reviewers.
Correct Answer:
B. Create an after insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
Explanation

Implementing dynamic, record-level access based on a custom lookup field requires Apex Managed Sharing. Standard criteria-based sharing rules cannot dynamically share a record directly to a user referenced dynamically in a record's lookup field; they strictly rely on static configurations or role hierarchies. Through Apex Managed Sharing, a share record (e.g., Convention_AttendeeShare) is programmatically instantiated and related to the parent record using an Apex Sharing Reason. Because share records inherently require an existing Parent ID to act upon, this programmatic logic must execute in an after context (after insert or after update). Attempting to instantiate the share record during a before trigger will definitively fail, as the newly created parent record lacks a Salesforce ID at that specific execution phase.

Why Incorrect

A. A before insert trigger executes prior to the record being saved, meaning the record does not yet possess an ID, rendering the creation of share records impossible.
C. Criteria-based sharing rules evaluate static data and cannot dynamically reference a user specified dynamically within a custom lookup field on individual records.
D. Sharing rules assign access to defined Public Groups or Roles and cannot be utilized to share specific records to distinct, individual users identified dynamically by a lookup.

References

Salesforce Apex Developer Guide, "Apex Managed Sharing", Section: Creating and Deleting Apex Managed Sharing.

Salesforce Apex Developer Guide, "Triggers", Section: Trigger Event Types.

Scroll to Top