SalesforceSalesforce
PDI · Question #210
PDI Question #210: Real Exam Question with Answer & Explanation
The correct answer is B: Sharing rules will be Inherited from the calling context.. When an Apex method's sharing context is not explicitly defined, it inherits the sharing context of the class or method that invoked it.
Submitted by sofia.br· Apr 18, 2026Logic and Process Automation
Question
In the following example, which sharing context will myMethod execute when it is invoked?
Options
- ASharing rules will not be enforced for the running user.
- BSharing rules will be Inherited from the calling context.
- CSharing rules will be enforced by the instantiating class.
- DSharing rules will be enforced for the running user.
Explanation
When an Apex method's sharing context is not explicitly defined, it inherits the sharing context of the class or method that invoked it.
Common mistakes.
- A. This describes
without sharingbehavior, which is only explicit or inherited from awithout sharingcontext. - C. Sharing rules are determined by the class definition (
with sharing,without sharing) or inheritance, not solely by the "instantiating class" which isn't a standard concept for sharing context. - D. This describes
with sharingbehavior, which is only explicit or inherited from awith sharingcontext. The default is not always enforced.
Concept tested. Apex class sharing context inheritance
Reference. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_sharing.htm
Topics
#Apex Sharing#Inherited Sharing#Apex Security#with sharing/without sharing
Community Discussion
No community discussion yet for this question.