In which mode(System/Automated Case User) EmailMessage trigger runs when we receive EmailMessage to create case,I checked in Logs and User is ('Automated Case User') that we setup on Support Settings.
1 Answer
Triggers are always run in system mode whichever user is doing the DML operations. If you need to enforce user mode, you need to implement apex class (with sharing) which should be invoked from trigger. And the permissions on different objects/fields can be enforced through profile/perm set for 'Automated Case User'
-
1Thanks @salesforce-sas ,Since Emails are created from Automated Case user and we are using Trigger Handler class with Sharing Keyword,it runs in Context of Automated User Context. Aug 11, 2019 at 19:38