function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ying liuying liu 

security control in trigger

Will DML follow security control in trigger?
I had a practice by myself and security control will not work in trigger just like without sharing. I did not find any document about this. I want to know why. Please help me. Thanks.
Anup JadhavAnup Jadhav
By default, the trigger will run in system mode (i.e. will have access to all records, objects and fields) and not in user mode. If you want it to run in user mode, then delegate the trigger logic to a class that has "with sharing" annotation.
KapilCKapilC
Hi Ying,

Here is a nice blog (https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices)where you can find detail info about your concern.

[If you got answer from my post please mark it as solution.]

Thanks,
Kapil