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

Email Service create records on behalf of another user

The documentation for Apex Email Service contains the following statement: "Associate a single Salesforce-generated email address with the email service, and write an Apex class that executes according to the user accessing the email service. For example, you can write an Apex class that identifies the user based on the user's email address, and creates records on behalf of that user."  I am interested in the part that talks about creating records on behalf of the emailing user.  Can someone point me to an example of this or at least what classes are involved?  I see System.RunAs but that says it only works in test methods.  I can create records and set the owner to the emailing user but the Created By field lists the Email Service's context user.  Thanks.