+ Start a Discussion
Kathryn BullockKathryn Bullock 

Send an Email with an attachment


Is it possible to create a button that will send an email and add one of the attached files, but only the most recently added file?  Please let me know if this is possible.
Please use code from here.

You just change the attachment query as below.
select Name, Body, BodyLength from Attachment where ParentId = :AccountId Order By LastModifiedDate DESC Limit 1

Please mark it best if it helps you. Thanks.
Kathryn BullockKathryn Bullock
Do I set the HTML body to reference fields from the record in the same way the email templates do?  Will this work in Lightning?  And how do I change the reciever of the email to a lookup contact field on the record?