+ Start a Discussion
naveen kunurunaveen kunuru 

with sharing ,without sharing

if a class  is with a keyword without sharing.what it going to happen 

what is known sharing rules wont be applicable to that class....

what else more then this ?
will it work in system mode r user mode?
what is diff b/w system mode and user mode
Hi Naveen,

system mode-> in which the object and field-level permissions of the current user are ignored. 
user mode->in which the permissions, field-level security, and sharing rules of the current user are enforced.
Here are the few links for your reference -:
1) http://www.salesforce.com/us/developer/docs/pages/Content/pages_intro_what_is_it.htm
2) http://aluniya.blogspot.in/2014/02/salesforce-system-mode-user-mode-and.html

Let us know if you need more clarity on this.
Mark this question as solved and choose the best answer if this answers your question.

Hi naveen kunuru,

The with sharing keyword allows you to specify that the sharing rules for the current user be taken into account for a class.

You have to explicitly set this keyword for the class because Apex code runs in system context. In system context, Apex code has access to all objects and fields— object permissions, field-level security, sharing rules aren’t applied for the current user. This is to ensure that code won’t fail to run because of hidden fields or objects for a user.

For more info please visit below link.

Let us know if it helps you.