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
Silpi Roy 14Silpi Roy 14 

With Sharing and without sharing

Suppose I have 10 Opportunities, out of which I have access to only 4 opportunities and I don’t have access on standard field of currency type – Amount filed on opportunity. If I perform SOQL query within an apex class which is running under With sharing mode to pull-out Opportunity Name and Amount. So how many records will return and what data I will see in amount?
Wilfredo Morillo 20Wilfredo Morillo 20
If the sharing rules are in effect the return would be the 4 opportunities that you have access to and null values for the amount field. 

Ref: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm

 
farukh sk hdfarukh sk hd