If a standard or VF page action causes a trigger to fire, does the trigger execute in the system context?

Assuming that the trigger only instantiates classes that are marked as without sharing does that trigger fire in the system context for:

  1. A standard object page
  2. A VF page with a controller or extension marked as with sharing


The trigger runs in system context for both cases, the with sharing only impacts record visibility, i.e. FLS etc will be ignored in both cases

If a class is not declared as either with or without sharing, the
current sharing rules remain in effect. This means that if the class
is called by a class that has sharing enforced, then sharing is
enforced for the called class.

I believe StandardController references are still an exception and still operate in user mode

so stdController.save() in a without sharing controller extension would still error, if the user did not having Edit access on the record.

Source : Link , Question Author : Wes Nolte , Answer Author : techtrekker

Leave a Comment