User and System Mode in Salesforce
User Mode: When an Apex class executes in user mode, it runs with the permissions and privileges of the current user who initiated the operation, also known as the executing user. In user mode, Apex code adheres to the organization's sharing rules, field-level security (FLS), and other user-specific permissions and settings. The visibility and access to records and data are determined by the security settings and permissions assigned to the executing user, including their role, profile, permission sets, and sharing settings. User mode is typical for most Apex transactions, such as trigger execution, Visualforce controller methods, and custom Apex code invoked by users through the Salesforce UI or API. System Mode: When an Apex class executes in system mode, it runs with elevated permissions and bypasses the organization's sharing rules, FLS, and other user-specific permissions. In system mode, Apex code can perform operations that are not available to the executing user, such a...