Activity Forums Salesforce® Discussions What is difference between system mode and without sharing keyword in Salesforce?

  • Nikita

    Member
    October 5, 2017 at 8:29 am

    The system mode ignores users permissions. In system mode, 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 example, logged in user doesn't have a "create" permission but they are able to create a record in System mode.

    All apex code run in system mode. It ignores user's permissions. The only exception is anonymous blocks like developer console and standard controllers. Even `runAs()` method doesn't enforce user permissions or field-level permissions, it only enforces record sharing.

    "Without sharing" keyword tells Apex code to ignore sharing rules, but not users permissions.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos