3

Does the Query Editor or Execute Anonymous (either via the Eclipse IDE or the Developer Console) run in System Mode or User Mode?

2 Answers 2

3

I did a bit of searching around for official reference, and there is one in the Apex Developer Guide - Using the with sharing or without sharing Keywords:

In system context, 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. The only exceptions to this rule are Apex code that is executed with the executeAnonymous call and Chatter in Apex. executeAnonymous always executes using the full permissions of the current user. For more information on executeAnonymous, see Anonymous Blocks.

2
  • You said "executeAnonymous always executes using the full permissions of the current user. " What is the meaning of full permission in context of current user ? It means user will treat like system admin profile(Full permission) in executeAnonymous ? Sep 20, 2016 at 11:20
  • No, the permissions of the current user, not the permissions of an admin.
    – Adrian Larson
    Sep 20, 2016 at 11:21
2

It is running in User Mode:

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.

Quote from http://aluniya.blogspot.com.au/2014/02/salesforce-system-mode-user-mode-and.html

Since I didn't find similar description in official documents, I have tested it myself and it proves out it is user mode.

4
  • Can you link to this reference?
    – Adrian Larson
    Sep 20, 2016 at 10:15
  • 1
    @AdrianLarson I didn't see that in official documents. Only see it in personal blogs and some community discussions. That's why I tested it.
    – Lance Shi
    Sep 20, 2016 at 10:19
  • Still, you're clearly quoting something. It might be better to convey that more explicitly is all I'm saying, and if that includes clarifying the uncertain voracity, so be it.
    – Adrian Larson
    Sep 20, 2016 at 10:22
  • @AdrianLarson Edited and added the reference.
    – Lance Shi
    Sep 20, 2016 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .