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
Sami ShakithSami Shakith 

Custom label is not displaying inside the mail attachment

Hi all,

I have created some custom label and used insed the Email template using VF page. Custom label is shown inside the body of the mail. But it showing values inside the attachment. Here is my code. Please some help me.
 
<messaging:emailTemplate subject="Opportunity Created" recipientType="User" relatedToType="Opportunity" language="{!CASE(relatedTo.ChooseCountry__c,'German','DE','English','EN','French','FR','Italian','IT','Danish','da','Spanish','es','Dutch','nl','Finnish','fi','Portuguese','pt','Swedish','sv','Polish','pl','Norweigian','no','Chinese (Simplified)','zh_CN','Chinese (Traditional)','zh_TW','Dutch','nl_NL','Finnish','fr','Japanese','ja','Korean','ko','Portuguese (Brazil)','pt_BR','Russian','ru','Thai','th','EN')}">
<messaging:HtmlEmailBody >
Congratulations {!relatedTo.Name} ! <br/><br/>
------------------------------------------------------------------------------<br/>
Your Opportunity has been created with following details!<br/>
------------------------------------------------------------------------------<br/><br/>

<table border="0" >
    <tr><td>{!$label.Opportunity_Name}</td><td>{!relatedTo.Name}</td></tr>
    <tr><td>{!$label.Account_Name}</td><td>{!relatedTo.Account.Name}</td></tr>
    <tr><td>{!$label.Stage_Name}</td><td>{!relatedTo.StageName}</td></tr>
    <tr><td>{!$label.Close_Date}</td><td>{!relatedTo.CloseDate}</td></tr></table>

</messaging:HtmlEmailBody>

<messaging:attachment renderAs="PDF">
<html>
<body>
<apex:outputText value="{!$Label.Greeting}" style="font-weight:bold"/><br/><br/>
    {!$label.Greeting}&nbsp;{!relatedTo.Name}!<br/>
    <table border="0" >
    <tr><td>{!$label.Opportunity_Name}</td><td>{!relatedTo.Name}</td></tr>
    <tr><td>{!$label.Account_Name}</td><td>{!relatedTo.Account.Name}</td></tr>
    <tr><td>{!$label.Stage_Name}</td><td>{!relatedTo.StageName}</td></tr>
    <tr><td>{!$label.Close_Date}</td><td>{!relatedTo.CloseDate}</td></tr></table>
</body>
</html>    
</messaging:attachment>
</messaging:emailTemplate>

 
Gyanender SinghGyanender Singh
Hi Sami Shahul,

My question is that why you are using custom lable in the mail template because if you use custom label and then set any value in the custom label then its showing the value.

Thanks
Gyani
Sami ShakithSami Shakith
Hi Gyanender Singh,

I want to show the attachment label based on the language. I have set the values for custom labels which i used in the email template. That custom label showing values inseide the email body. but it not showing inside the attachment.
Gyanender SinghGyanender Singh
Hi Sami Shahul,

I create the custom label and email template and for testing purpose i have sent mail and i send you screen shot of both image i.e. email body and attachment ,let me know this is your requirement.

User-added imageUser-added image

Thanks
Gyani
Sami ShakithSami Shakith
Yeah I am also getting for English. Please create Translation for japanese or korean language.