System Mode:
1. System mode running apex code by ignoring user’s permissions.
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.
User Mode:
1. User mode running apex code by respecting user’s permissions and sharing of records.
2. Profile level permissions, field-level security, and sharing rules are applied for the current user.
Modes Of Execution in Salesforce
Apex Class | System Mode |
Triggers | 1. If triggers call an apex class with sharing keyword, Then record level access permissions will be considered. |
Anonymous Apex | User Mode |
Apex Webservices (SOAP API and REST API) | System Mode |
Validation Rule | System Mode |
Workflow Rule | System Mode |
Process Builder | System Mode |
Formula Fields | System Mode |
Custom Button | System Mode |
Roll Up Summary Fileds | System Mode |
Auto Response Rule | System Mode |
Assignment Rule | System Mode |
Escalation Rule | System Mode |
Approval Process | System Mode |
Flows | By Default runs in User Mode 1. if flow called from Process Builder it runs in System Mode. 2. if flow called from Workflow it runs in System Mode. 3. if flow called from Apex it runs depends on With or With Out Sharing of apex class |
Test Class | 1. Test Method with System.runAs() runs in User Mode. 2. Test Method without System.runAs() runs in System Mode. |
All Type of Jobs | System Mode |
Email Service | User Mode |
Visualforce Page | Standard Controller --- User Mode Standard Controller With Extensions --- System Mode Custom Controller---- Based Sharing Keyword Used in Apex Class. |
Visualforce Component | It depends on the Visualforce page where it is used. |
Chatter in Apex | User Mode |
Macros | System Mode |
InvocableMethod | 1. if it is called from Flow it will run in User Mode. 2. if it is called from Process Builder (does it depends on with or without sharing is specified on that Class), then runs in System Mode |
Publisher Action | System Mode |
Custom Button | System Mode |
No comments:
Post a Comment