You need to sign in to do that
Don't have an account?
Rajesh T 19
When using a class with sharing keyword what are the functions will be enforced ?
I read some blogs states only sharing rules for the current user are considered for the class it seems sharing rules on the record level visibility. But some blogs says Field level security of the current user also enforced.
Am confused here so can anyone tell me what are all the functions are considered when using Sharing keyword.
Am confused here so can anyone tell me what are all the functions are considered when using Sharing keyword.
Use the with sharing or without sharing keywords on a class to specify whether sharing rules must be enforced. Use the inherited sharing keyword on an Apex class to run the class in the sharing mode of the class that called it.
You can go through below documentation for detailed explaination.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm
Hope this answers your question, if so please can you mark this as best answer. Thanks.
With sharing Keyword
This keyword enforces sharing rules that apply to the current user. If absent, code is run under default system context.
Example
Without sharing keyword
Ensures that the sharing rules of the current user are not enforced.
Example
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh