Thursday 26 February 2015

What is the Difference B/w With Sharing and Without Sharing Classes in Apex?

Ans:  
With Sharing: If  you declare a class as with sharing, Sharing rules given to the current user will be taken in to the consideration and user can access and perform the operations based on the permissions given to him on objects to fields. 

Without Sharing: If you declare a class as without sharing, then this  apex class runs in system mode which means apex code has access to all the objects and fields irrespective of current user sharing rules, field level security and Object permissions.

No comments:

Post a Comment