You need to sign in to do that
Don't have an account?
Chanagan Sakulteera
Thank you
VF Email template cannot use Component that passing parameter to controller with Email Alert
Hi all, I have a problem regarding Visualforce Email Template with component and controller when I use it with workflow and email alert.
No email was send to me but if I use the button "Send Test and Verify Merge Fields" It works just fine.
The problem is that I am trying to send parameter from VF Email template to component and then pass on to controller.
This is my code in VF email template :
<messaging:emailTemplate subject="Your insurance quote" recipientType="User" relatedToType="Account" > <messaging:htmlEmailBody > <c:SSST_Quotation_Number ShowAcctID="{!relatedTo.Id}" rendered="true"></c:SSST_Quotation_Number> </messaging:htmlEmailBody> </messaging:emailTemplate>
This is my code for component :
<apex:component controller="SSST_Email" access="global" > <apex:attribute access="global" name="ShowAcctID" assignTo="{!contactID}" type="ID" description="Account ID"/> <apex:outputLabel value="{!QuoNumber}" > </apex:outputLabel> </apex:component>
This is my code for controller :
global with sharing class SSST_Email { public ID contactID; public ID getcontactID() { return contactID; } public void setcontactID(ID s) { contactID = s; mycontactID(); } public void mycontactID() { if(contactId != null){ acct = [select id , Name , Contact_Email_Address__c , Preferred_Language__c from account where id =: contactId ]; AccountId = acct.Id; getQuotationNumber(); } } public void getQuotationNumber() { List<Quotation__c> Quo = [select name , quotation_number__c , quote_expire_date__c from quotation__c where contact_number__c =: AccountId order by name desc limit 1]; QuoNumber = Quo[0].Quotation_number__c; QuoExpDate = Quo[0].Quote_Expire_Date__c; QuotationId = Quo[0].Id; }
If I use component in VF Email template without passing parameter it works.
<c:SSST_Quotation_Number ></c:SSST_Quotation_Number>It won't work when I use
<c:SSST_Quotation_Number ShowAcctID="{!relatedTo.Id}" ></c:SSST_Quotation_Number>
Thank you
Andy Boettcher
Did you set the "Object" value right in the Email Alert?