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.


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 });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.