You need to sign in to do that
Don't have an account?
Makam Ruthvik
attach file that is on a record to email template
Hi All,
I have a pdf attached to files in Order records{PDF has a unique name so have to query based on it's name}. How to query it from the Order record and attach it to Classic Email Template. Please help me here. Thanks in Advance
I have a pdf attached to files in Order records{PDF has a unique name so have to query based on it's name}. How to query it from the Order record and attach it to Classic Email Template. Please help me here. Thanks in Advance
The good news is that you have another option except for using external images.
Using an inline attachment with a Content-ID works with Gmail.
After adding your images as inline attachments you'll need to point CID URLs instead of Data URLs in the html body.
There are plenty of modern libraries that will allow you to send emails with inline attachments easily. But I wrote a sample script in VBScript with CDO library, ready to use if you have a box Windows 2000+ installed.
Let's prepare the test environment.
DGCustomerFirst (https://www.dgcustomerfirst.org/)
you can query documents/files from org using ContentdocumentLink ok i'll provide you a sample Query ,Mark the best answer ,so it helps other.
ContentDocumentLink cdl:[SELECT LinkedEntityId,ContentdocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN:acctIds])
Where LinkedEntityId is the Id of records where your document is attached && ContentdocumentId is teh id of your document .
and another how to send document in email in (messaging.SingleEmailmessage)
please refer below code to ger some idea
list<contentVersion> covVer=[SELECT id,contentDocumentId,Title,versionData FROM contentVersion WHERE contentDocumentId=:con.contentDocumentId];
Messaging.singleEmailMessage mail=new Messaging.singleEmailMessage();
list<string> toaddress=new list<string>();
toaddress.add(c.Email);
mail.setToAddresses(toaddress);
mail.setSubject('your Subject');
mail.setPlainTextBody('This is first email attachment');
mailList.add(mail);
messaging.EmailFileAttachment efa=new messaging.EmailFileAttachment();
efa.setFileName(covVer[0].Title);
efa.setBody(covVer[0].versionData);
mail.setFileAttachments(new messaging.EmailFileAttachment[]{efa});
}
}
messaging.sendEmail(mailList);
}
Thank You
Mark the best answer ,so it helps other.
Thanks for the above information but how to add it my classic email template. I have already a vf page that goes from that template and need to add an attachment. I want to add the attachment to classic email template basically. Can you please help me here.