You need to sign in to do that
Don't have an account?
Nandhini s 11
with sharing and without sharing in apex
Hi guys,
I know 'with sharing' enforces sharing rules of the current user and 'Without sharing' doesn't.
My doubt is, what is sharing rules? is it the criteria/owner based sharing rule we write for an object? or does it mean the access a user has on an object?
Where do we use these keywords in real time?
Is the current user, the user who executes the code?
I know 'with sharing' enforces sharing rules of the current user and 'Without sharing' doesn't.
My doubt is, what is sharing rules? is it the criteria/owner based sharing rule we write for an object? or does it mean the access a user has on an object?
Where do we use these keywords in real time?
Is the current user, the user who executes the code?
The keywords are used at the class level definition. This is most common when writing Visualforce controllers or API endpoints. However, you can use them in triggers to bypass sharing rules if needed.