Salesforce Developers Salesforce Consultants Salesforce Salesforce Developers

HELLO|WELCOME TO CLOUD HELP|A SALESFORCE SOLUTION|WE LOVE TO DO CREATIVE THINGS|SALESFORCE CONSULTANTS FROM INDIA

With sharing & Without sharing in Salesforce Apex!

The most confusing and always been part of discussion where the answer is not satisfactory!

With sharing & Without sharing in Apex.

Remember theses points:
  • If nothing mentioned in class then default is "Without sharing".
  • If nothing defined in class and called within other class then it will execute with calling class's sharing setting accordingly.
  • The sharing setting applies to all code contained with in the class, including initialization code, constructors, and methods.
  • Inner classes do not inherit the sharing setting from their container class.
  • If a with sharing class calls a without sharing class, then the called method(s) will be executed in the mode of the class in which they were defined, in this case, the called method(s) will execute in without sharing mode.
  • The 'without sharing' keyword is to ensure that the sharing rules (not permissions) for the current user are not enforced.
  • The with sharing keyword allows you to specify that the sharing rules (and not permissions) 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 mode.



Share this:

CONVERSATION

1 comments:

  1. Great and useful post. I really got more information from your webpage. This sales force concepts was really helpful.
    Regards,
    Salesforce Training in Chennai | Salesforce course in Chennai

    ReplyDelete

Navneet kumar, Software consultant from delhi, India. Basically from Bisfi, Madhubani Bihar. Software Engineer!

Navneet kumar bisfi madhubani bihar

Navneet bisfi madhubani bihar

Nabu Nabbu bisfi madhubani bihar

Navneet Software consultant from delhi

Navneet kumar Software consultant from delhi

Navneet kumar Software Engineer bisfi madhubani bihar

Nabu Nabbu Software Engineer bisfi madhubani bihar

bisfi madhubani bihar

Salesforce

Salesforce Consultant

Salesforce Developer

Salesforce Best Blog

Salesforce Cloud Computing

Cloud Computing

Salesforce Customizations

Salesforce Developments

Apex Salesforce

Apex Controllers

Salesforce Triggers, classes, work flows