You need to sign in to do that
Don't have an account?
Simple passing of values from a LOCAL Apex variable list to FileAttachments
Usual page and custom controller stuff.
There is this custom VF page that simulates the standard Send an Email page. I have all the required attachments stored in a local <list>attachment variable called attach_criteria. How do I make a transfer from this attach_criteria to fileAttachments so that I can set up the email attachments to be sent? I tried using the following for-loop:
for(i=0; i < attach_criteria.size(); i++){ messaging.Emailfileattachment efa = new Messaging.Emailfileattachment(); efa.setFileName(attach_criteria[i].Name); efa.setBody(attach_criteria[i].Body); } message.setFileAttachments(fileAttachments);
but I get the error:
SObject row was retrieved via SOQL without querying the requested field: Attachment.Body
Please show me with code how I can pass values from attach_criteria to fileAttachments. Thanks for your time.