Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Can we use other object's field in VF template, if yes then how? Please suggest.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Yes, you can use another object field using a component and for this you need to make a apex controller.

share|improve this answer

You can do that by creating a Visualforce Email Template with a Custom Controller.

Here are the steps:

  1. Create a Custom Controller Apex class.
  2. Create a Custom Component that has its controller attribute set to the class created in step #1.
  3. Create a Visualforce Email Template that includes the Custom Component created in Step #2.

This is outlined with an example in the documentation Using Custom Controllers within Visualforce Email Templates.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.