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
DCBoyDCBoy 

Applying Templates in VF page

Hi

While creating an email, our users like the concept of applying a template for canned response. They would like to have a similar functionality for creating case notes (aka Comments). Out of the box, I dont believe you can extend templates to other objects. So using custom visual force and apex, I was able to get the list of templates but am stuck figuring out how to apply the template? Can you please provide some pointers on how to apply template to a record and get the output so a note can be created?

 

 

super developersuper developer

Do you want Apply template in visual force for sending email.

 

In controller

 

 Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setUseSignature(false);
    mail.setTargetObjectId(con.id);//contact id
    mail.setTemplateId(eid);// template id
    mail.setWhatId(noteid);//note record id
   
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });