function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
asadimasadim 

Sharing context when calling packaged code

Is sharing enforced from the top calling class to the bottom classes?

Pseudo: TopClass.method() > calls PCKG.ServiceClass.doWork() > calls PCKG.HelperClass.doHelp()

If TopClass is defined using "without sharing" do the packaged classes (Service & Helper) run in the same sharing context?

Thanks.
Gupta.VishalGupta.Vishal
The sharing setting of the class where the method is defined is applied, not of the class where the method is called. For example, if a method is defined in a class declared with with sharing is called by a class declared with without sharing, the method will execute with sharing rules enforced.

Hope this helps :)