Activity Forums Salesforce® Discussions what is the difference between system mode and user mode?

  • Ratnakar

    Member
    March 20, 2018 at 11:08 am

    Hi,

    System Mode basically runs Apex code while ignoring the user’s permissions and privileges. In the System Mode, Apex code will have access to all the fields and objects while sharing rules and field security aren’t applied to the current user.

    All Apex code runs on System Mode and this ensures that the code won’t fail to run because of hidden objects for the user or hidden fields. The only exceptions here are anonymous blocks like standard controllers and developer consoles.

    In the User Mode, the code will be executed taking the privileges of the user into consideration. On the Salesforce platform, only Anonymous Apex and standard controllers can be executed in User Mode. In other words, it only runs Apex code by respecting the user’s permissions and sharing of records.

     

  • Parul

    Member
    September 11, 2018 at 6:43 pm

    hi

    System mode -System mode is nothing but running apex code by ignoring user's permissions. For example, logged in user does not have create permission but he/she is able to create a record.
    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.
    In Salesforce, all apex code run in system mode. It ignores user's permissions. 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.

    User mode - User mode is nothing but running apex code by respecting user's permissions and sharing of records. For example, logged in user does not have create permission and so he/she is not able to create a record.
    In Salesforce, only standard controllers and anonymous blocks like developer console run in user mode.

     

    Thanks

  • shariq

    Member
    September 15, 2018 at 1:28 pm

    Hi,

    To make it more simple -

    User Mode - Profile level permissions, field-level security, and sharing rules of the current user are enforced.

    System Mode - Object permissions, field-level security, sharing rules aren't applied for the current user.

    Hope this helps.

    • This reply was modified 6 years, 2 months ago by  shariq.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos