Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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


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.