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
mat_tone_84mat_tone_84 

insert into template an attachment stored in opportunity

Hi,
I need to create a template for use into opportunity which get attachment stored into the opportunity into note&attachments.
I'm able to do this with a trigger but I'm not able to create a template.
My goal is to send an email and the receiver will be able to open pdf.
I try this code but I have a pdf with this text : "core.filemanager.ByteBlobValue@22ad1468" 

<messaging:emailTemplate subject="test email" recipientType="Contact" relatedToType="Attachment">
<messaging:plainTextEmailBody >
test new template xxxx
</messaging:plainTextEmailBody>
<messaging:attachment renderAs="pdf" filename="filename.pdf">
{!relatedTo.body}
</messaging:attachment>
</messaging:emailTemplate>

I found some topic for convert "body" into a blobvalue or similar but I didn't solve the problem
Vinita_SFDCVinita_SFDC
Hello,

Please refer following document and threads referring similar issue:

http://salesforce.stackexchange.com/questions/22251/insert-attachment-into-visualforce-email-template
http://salesforcetrekbin.blogspot.in/2010/05/visualforce-email-template-with.html
http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_templates_with_apex.htm
mat_tone_84mat_tone_84
Hello,
the 3 links that you have posted don't show me what I want.
they explaine how create a template with the link to the pdf, and so the receiver of my email need to login on salesforce for see the pdf, instead I need that who receive my email don't need login on salesforce and can see the pdf as attachment of email

Divya SDivya S
Hi Mattone84,  

Have you got the solution for you issue, I am running into the same issue and have been struggling with it for the past 2 days.  I would appreciate your response. Thanks !
mat_tone_84mat_tone_84
sorry but I solve with a trigger
sreejasreeja
hi mat_tone are you availble , i have a query .. 
thanks and regards 
priya