Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
error

We made a wrong turn. Try again.

In the snippet below… templateID is valid and set active.  Can query it no prob.However the template does not show in the resulting email. 

If instead, I use mail.setHtmlBody() it works fine.  Any ideas why templates aren't working?

 

id templateID='00X1R000000f3T1UAI';

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setTemplateId(templateID);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 
2 answers
  1. Jun 11, 2021, 7:29 AM
    Hi Steve,

    Can you please share below detail:

    1 Are you using dynimic email template 

    2. object name that's you are using in email

    REgards

    Mukesh

     
0/9000