+ Start a Discussion
pgonzaleznetworkpgonzaleznetwork 

Visualforce Email Template merge fields

Hi Team,

 

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

 

http://wiki.developerforce.com/page/VisualForceEmailTemplates_sample

 

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}">

              <tr>

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

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

                <td>{!cx.CaseNumber}</td>

                <td>{!cx.Subject}</td>

                <td>{!cx.Contact.email}</td>

                <td>{!cx.Status}</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. 

Rahul_sgRahul_sg

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.

pgonzaleznetworkpgonzaleznetwork

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.

 

Thanks.