You need to sign in to do that
Don't have an account?
Terence Viban
Passing parameters from email template to component
Problem: In the email template, i am using a component which expects the account Id. This is assigned to a property on the Controller. The account Id never gets passed to the controller. On the UI "Set Test and Verify Merge Fields" everything works perfectly fine.
Template
<messaging:emailTemplate subject="Quote" recipientType="Contact" relatedToType="Account">
<messaging:htmlEmailBody >
<html>
<body>
<c:KoreanTest acct="{!relatedTo.Id}" />
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Component:
<apex:component controller="CtrKoreanTest" access="global">
<apex:attribute name="acct" type="String" description="Placeholder" assignTo="{!acctId}"/>
<table width="100%">
<tr>
<td class="headelements" ><div style="width: 200px;"><img src="{!URLFOR($Resource.Yogiyo_Logo)}" /></div></td>
<td class="headelements" style="font-weight: bold; font-size: 17px;">요기요 서비스 등록 신청서</td>
<td class="headelements">
<div><span style="width: 10px;">담당자</span> : {!accountWrapper.Name} </div>
<div><span style="width: 10px;">연락처</span> : {!accountWrapper.Company_Number__c}</div>
</td>
</tr>
</table>
<br />
</apex:component>
Controller:
public without sharing class CtrKoreanTest {
public String acctId { get; set; }
public CtrKoreanTest() {
}
public ClsAccountWrapper getAccountWrapper(){
ClsAccountWrapper accountWrapper;
if(acctId != null){
acct = [SELECT Id, Name, Company_Number__c FROM Account WHERE Id =: acctId];
accountWrapper = new ClsAccountWrapper(acct);
}
return accountWrapper;
}
}
ClsAccountWrapper is a simple wrapper class
I will very much appreciate any ideas what to look for.
Thanks
Template
<messaging:emailTemplate subject="Quote" recipientType="Contact" relatedToType="Account">
<messaging:htmlEmailBody >
<html>
<body>
<c:KoreanTest acct="{!relatedTo.Id}" />
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Component:
<apex:component controller="CtrKoreanTest" access="global">
<apex:attribute name="acct" type="String" description="Placeholder" assignTo="{!acctId}"/>
<table width="100%">
<tr>
<td class="headelements" ><div style="width: 200px;"><img src="{!URLFOR($Resource.Yogiyo_Logo)}" /></div></td>
<td class="headelements" style="font-weight: bold; font-size: 17px;">요기요 서비스 등록 신청서</td>
<td class="headelements">
<div><span style="width: 10px;">담당자</span> : {!accountWrapper.Name} </div>
<div><span style="width: 10px;">연락처</span> : {!accountWrapper.Company_Number__c}</div>
</td>
</tr>
</table>
<br />
</apex:component>
Controller:
public without sharing class CtrKoreanTest {
public String acctId { get; set; }
public CtrKoreanTest() {
}
public ClsAccountWrapper getAccountWrapper(){
ClsAccountWrapper accountWrapper;
if(acctId != null){
acct = [SELECT Id, Name, Company_Number__c FROM Account WHERE Id =: acctId];
accountWrapper = new ClsAccountWrapper(acct);
}
return accountWrapper;
}
}
ClsAccountWrapper is a simple wrapper class
I will very much appreciate any ideas what to look for.
Thanks
Vishnu Vaishnav
can you put your whole code..it will helpfull for me to solve out..