System Mode and User Mode in Salesforce

System Mode and User Mode in Salesforce

Trigger runs in System mode. If triggers calls an apex class with sharing keyword, then record level access will be considered.Validation Rule runs in System mode.

Auto Response Rule runs in System mode.

Assignment Rule runs in System mode.

Workflow Rule runs in System mode.

Escalation Rule runs in System mode.

Formula, Roll-up Summary runs in System mode.

Process Builder runs in System mode.

Custom Button runs in System mode.

Visual Workflow or flow runs in User mode.
If flow is called from Process Builder, then runs in System mode.
If flow is called from Workflow, then runs in System mode.
If flow is called from Apex, then runs in (depends on with or without sharing of apex class).
If flow is called from Custom Button, then runs in System mode.
If flow is embed in Visualforce, then runs in VFP context.
If flow is called from REST API, then runs in System mode.

Approval Process runs in System mode.

Publisher Action runs in System mode.

InvocableMethod
If this is called from flow, then runs in User mode.
If this is called from Process Builder, then it depends on with or without sharing is specified on that Class.
if this is called from REST API, then runs in (depends on with or without sharing of the class).

Test method with System.runAs() runs in User mode.
Test method without System.runAs() runs in System mode.

Visualforce Page (StandardController) runs in User mode.
Visualforce Page (StandardController with extension) runs in System mode.
Visualforce Page (Custom Controller) – Based on the sharing keyword usage in the apex class.
Visualforce Component runs in depends on Visualforce page where it is used.

Macros runs in System mode.

Anonymous Apex runs in User mode.

Chatter in Apex runs in User mode.

Email Service runs in User mode.

All types of Jobs runs in System mode.

Apex Web services (SOAP API and REST API) runs in System mode.

Leave a Reply