0

How to update the apex:dataTable used in the visualforce email template, when editing the properties of the visualforce template from Apex.

I am able to query the markup from email template and update other parameters in the visualforce email template but not able to assign the value for "relatedTo.MLM_Product_Lines__r". I am kind of doing the string replacement in apex through markup.

1 Answer 1

0

setting up the "setWhatId" to respective relatedTo object record worked instead of re-constructing the entire markup by querying the Email Template record.

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
mail.setTargetObjectId(UserInfo.getUserId()); 
mail.setTemplateId(et.Id);
mail.setWhatId(relatedTo.Id); 
mail.setBccSender(false); 
mail.setUseSignature(false); 
mail.setSenderDisplayName('Card Division'); 
mail.setSaveAsActivity(false); 
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .