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
hegde_hegdekhegde_hegdek 

Passing custom object reference to email template

hello friends,

I have an email template with an attachment(rendered in PDF),the attachment has reference to values from multiple standard objects like contact,oppurtunity etc.so what i have done to address this is to create a custom object,which is having all the needed fields from the standard objects.in the apex code then using the standard api Messaging.SingleEmailMessage,i use the method setTargetObjectId to set the cutom object and also the email template has the field relatedToType referencing this custom object,so that i can reference in the attachment,is this the right approach.

regards

hegdek