11 Replies to “Visualforce Email Template with Records”

  1. Absolut fantastic, you made my day!! Before I found your side I was trying everything to pass those attributes from the VF component to the controller but nothing seems to work. I used assignTo with getParameter() etc. etc. but always got a NULL for the
    Then I found your solution and what could I say WOW…. I only had to change the variables and controller from Public to Global and it works.
    In every possible solution I found so far in the net, they use Public nd it didn’t work.
    Thanks a lot man!!!

    Liked by 1 person

  2. Please find my code which is not triggering email.

    Apex class:
    public class acctTemplt
    public Id Traveling_Dependents{get;set;}
    public List getopptys()
    List oppty;
    oppty = [SELECT Dependent__c FROM Traveling_Dependents__c WHERE Travel_Request__c =: Traveling_Dependents];
    return oppty;

    VF Controller:

    Dependent Name


    Email Template:

    Below is the list of Travelling Dependents for your Travel Request {!relatedTo.Name}.



  3. Hi sfdcFanBoy, I was working on same scenario but different objects.
    These two objects are connected with masterdetail relationship with field name “Travel_Request__c”, when I replace Accountid with Travel_Request__c in
    global String accountId{get;set;}
    then I am getting error, can you please help me out for this


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s