Activity Forums Salesforce® Discussions What is system and user mode ?

  • Prachi

    Member
    October 9, 2019 at 5:58 am

    Hi Saddam,

    System Mode:

    1. System mode is nothing but running apex code by ignoring user’s permissions. For example, if logged in user does not have create permission but they will able to create a record.
    2.In system mode, Apex code has access to all objects and fields 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.
    3.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:

    1.User mode is nothing but running apex code by respecting user’s permissions and sharing of records. For example, if logged in user does not have create permission they are not able to create a record.
    2.In User mode, Profile level permissions, field-level security, and sharing rules are applied for the current user.
    3.In Salesforce, only standard controllers and anonymous blocks like developer console run in user mode.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos