You need to sign in to do that
Don't have an account?
@jpmaria
how to represent & in messaging:attachment in vf page email template attachment?
for classic email template using VF page - & can be displayed in messaging:htmlEmailBody using & but in same template messaging:attachment does not support & or & . for a csv attachment when placing & in messaging:attachment - it shows error, and when placing & it comes as '&' itself
with what Mayank Tolambia @ Salesforce Technical Support has suggested <apex:outputText value="&" escape="false"/> works well for getting & without amp; in csv also
, for the sample code I've provided before, the following modification gives & as expected in csv attachment
<messaging:emailTemplate subject="Sample Subject" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
Sample Content with & that works as expected.
Thanks,<br/>
{!$User.firstName} {!$User.LastName}<br/>
{!$User.Email}<br/>
{!$User.Phone}<br/>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:attachment filename="Sample.csv"><apex:outputText value=" Column Header with &" escape="false"/>
</messaging:attachment>
</messaging:emailTemplate>
All Answers
Can you share a reproducible code snippet so that I can try this behaviour in my org to suggest? Thanks
Checked:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_messaging_attachment.htm
<messaging:emailTemplate subject="Sample Subject" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
Sample Content with & that works as expected.
Thanks,<br/>
{!$User.firstName} {!$User.LastName}<br/>
{!$User.Email}<br/>
{!$User.Phone}<br/>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:attachment filename="Sample.csv">Column Header with &
</messaging:attachment>
</messaging:emailTemplate>
thanks Swetha
Kindly try this code, while testing via Send Test and verify merge fields, or sending from Compose Email to a contact, the '&' inside messaging:htmlEmailBody comes as '&' but '&' inside messaging:attachment comes as '&' itself
this behavior can be observed by downloading the csv that is sent as an attachment with the mail
that is, in mail, '&' is coming as &, but in the attached csv file, '&' is coming as '&'
what can be done to bring '&" in csv file attachment
with what Mayank Tolambia @ Salesforce Technical Support has suggested <apex:outputText value="&" escape="false"/> works well for getting & without amp; in csv also
, for the sample code I've provided before, the following modification gives & as expected in csv attachment
<messaging:emailTemplate subject="Sample Subject" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
Sample Content with & that works as expected.
Thanks,<br/>
{!$User.firstName} {!$User.LastName}<br/>
{!$User.Email}<br/>
{!$User.Phone}<br/>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:attachment filename="Sample.csv"><apex:outputText value=" Column Header with &" escape="false"/>
</messaging:attachment>
</messaging:emailTemplate>