I have a field that is used in an email template for which no FLS is granted in any profiles.
The Apex code that sends the email using messaging.sendEmail() is invoked from a trigger so I assume it to be running in system mode and that FLS is not relevant.
However, when that email is sent, and the trigger is executed by a record update, made when logged into a community as a user with profile BoringUser, the referenced field is not rendered into the email.
If I add read permissions for the System Administrator profile and perform the same operations. Log into community as BoringUser, cause a record update. Trigger fires and sends email, then the email received contains the expected merge field.
Why does granting read permission to the System Administrator profile influence field level access for code that should be running in System Mode?
BoringUser
without sharing