1

I have a Visualforce page and I'm using the standard controller for the quote object. I added a custom field to the Quote object, QuoteContact, which is a lookup data type. Everything looks good on Salesforce Quote page, but on a separate VF page I need to display the name, phone number, and email for the Contact.

enter image description here

I have tried various options unsuccessfully. In short, {!quote.QuoteContact__c} will display the contact ID, but if I try to access any of the properties, e.g.{!quote.QuoteContact__c.name}, then I get an error:

Error: Unknown property 'String.name'

Using an outputField tag, <apex:outputField value="{!quote.QuoteContact__c}" />, displays the name as a clickable link, but I don't want this to be in the form of a link, and I also need the email and phone number.

Can anyone help with this? This seems like it should be pretty straight forward, but I can't get it to work.

1

The field you are accessing is on the parent and you need to access it through __r notation instead of __c.

Use {quote.QuoteContact__r.field_api} and this should work.

Let me know if any other help needed. :)

Thank You.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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