Activity Forums Salesforce® Discussions What is Sharing and without Sharing in Apex class of Salesforce?

  • What is Sharing and without Sharing in Apex class of Salesforce?

    Posted by Aditya on November 12, 2020 at 2:47 pm

    What is Sharing and without Sharing in Apex class of Salesforce?

    Shweta replied 4 years ago 2 Members · 1 Reply
  • 1 Reply
  • Shweta

    Member
    November 12, 2020 at 2:50 pm

    With sharing Keyword enforces sharing rules that apply to the current user. If absent, code is run under the default system context. Use the with sharing keywords when declaring a class to enforce the sharing rules that apply to the current user.
    Without sharing keyword ensures that the sharing rules of the current user are not enforced. Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example, you may want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it is called from another class that is declared using with sharing.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos