You need to sign in to do that
Don't have an account?
Martin Y
Invalid constructor name: EmailFileAttachment
Hi
I'm trying to use a function call to return a new email file attachment (I'm calling the subroutine from a few different places within the same batch class). However, I'm getting a compilation error: invalid constructor name: EmailFileAttachment. Does this mean I cannot return a Messaging.EmailFileAttachment constructor from a function, or am I doing something wrong?
private Messaging.EmailFileAttachment (Attachment AttachRec) { // Create the mail message attachment Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment(); attach.setContentType(AttachRec.ContentType); attach.setFileName(AttachRec.Filename); attach.setInline(false); attach.Body = AttachRec.body; return attach; }
Many thanks in advance!
Martin
Shouldnt it be something like
private Messaging.EmailFileAttachment Func1(Attachment AttachRec)
All Answers
This Document may help you.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_sending_attachments.htm
Shiv
Thanks for the speedy response, but I've seen this page and it doesn't help. I know that I can add an attachment (and it works succesfully) but I would need to replicate my function call throughout my code a number of time. So I really just want to pass the EmailFileAttachment variable returned from a function, but it appears that I cannot create a constructor to do this.
Does this make sense?
Martin
Shouldnt it be something like
private Messaging.EmailFileAttachment Func1(Attachment AttachRec)
Oh dear.... I was completely focussing on the wrong thing wasn't I! Many thanks Jerun!!!