I have the "quote" object and I want to print a field in the vfp (Tax Number) that is in the account object, and I have the "Account Name" field (API-AccountId) which is a lookup for the "Account" object...as do I print the value of "Tax Number" that is in the object "Account"? It's probably simple but it's confusing me, I appreciate you giving me some light...


<apex:page standardController="Quote" extensions="extWordDocQuoteCreator" showHeader="false" standardStylesheets="false" cache="true">
<apex:outputText value="{!quote.Account.Tax_Number__c}"/>

I have a select in the controller that gets the fields of the quote object...but I don't know if it's necessary for my question... I am getting the following error: Invalid field Account for SObject Quote

enter image description here

enter image description here

1 Answer 1


A merge field starts with {! and ends with }. You forgot the !, so it is parsed as just a normal string. Second, you need to start from the base record. If you're using a standard controller, it's the name of the object. In addition, standard fields don't use __r for a relationship, you just drop the Id from the field name. As such, the code you're looking for is likely:

<apex:outputText value="{!Quote.Account.Tax_Number__c}"/>
  • Thanks for the reply @sfdcfox, I tried what you said and it returned the following error: Invalid field Account for SObject Quote :(
    – Souza
    Commented Nov 25, 2021 at 21:45
  • 1
    @GuedesSá Hmm, it works for me. I do recall something weird about the Account field, but it should work if everything is good. Check your page's API version, and make sure you're using standardController="Quote".
    – sfdcfox
    Commented Nov 26, 2021 at 1:55
  • I still don't quite understand why, but it worked when I used:<apex:outputText value="{!quoteObj.Opportunity.Account.Tax_Number__c}"/> I imagine it must be something with the structure
    – Souza
    Commented Nov 29, 2021 at 20:50
  • 1
    @GuedesSá so, you're using a custom query in your Apex, rather than normal SOQL Visualforce binding, is all. Nothing wrong with that.
    – sfdcfox
    Commented Nov 29, 2021 at 21:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .