+ Start a Discussion

Visualforce Email Template merge fields

Hi Team,


I'm creating my first visualforce template using the example given here 




I'm not sure that I understand how merge fields work here, so I'd appreciate some help. I can see this code on the template:


<apex:repeat var="cx" value="{!relatedTo.Cases}">


                <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> | 

                <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>





 Can you please confirm that what's happening here is that you are creating a variable, declaring it with the {!relatedTo.Cases} value and then using (!cx.CaseNumber) as merge fields?


How do I know what the merge fields are, i.e Contact.email versus ContactEmail or Case.ContactEmail?


Are these the same merge fields use in email templates and/or formulas?


Thank you for your help. 


If you just need merged field syntax then try creating a text template first. You have an option (dropdown) to select object and field and then copy the displayed value from Copy Merge Field Value text box.


Yes I'm aware of that functionality. I'll play with it more later and mark this as a solution if appropriate. Any more inputs would be appreciated.