0

I am using the following source to display field values in visual force: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_display_field_values.htm

I am passing in the correct account id and also managed to modify the code from the source to also have it print the postal code. However I took the {!account.billingPostalCode} portion from Google... Thus I do not know how to access the other fields such as phone

<apex:page standardController="Account">
Hello {!$User.FirstName}!
<p>You are viewing the {!account.name} account with a postal code of {!account.billingPostalCode}.</p> 
</apex:page>

My goal is to create a visualforce page that lists all my saved accounts along with their fields such as the phone.

My question:

  1. Is their any source that contains a list of all possible field values? Such as {!account.billingPostalCode}

P.S. I does not really help if someone just gives me the field like {!account.billingPostalCode}, because I will eventually want to include values from cases and I will have the same question again.

1

1 Answer 1

2

Visualforce can display (almost) any field in your organization, as well as extra fields that you can use exclusively in Visualforce pages. As such, there is no comprehensive list that would include every possible field, because you can create your own fields and objects!

Generally speaking, when you use a standardController, you can access all of the object's fields, all of its direct children, parents, grandparents, great-grandparents, and great-great-grandparents. The standardController should match the object used in the merge fields.

In your example, you said you wanted to use Cases, so you'd do this:

<apex:page standardController="Case">
    {!Case.Subject}
</apex:page>

As further examples, you could use a Contact:

<apex:page standardController="Contact">
    {!Contact.Name}
</apex:page>

Or a Custom Object called Inventory__c with a custom field Quantity__c:

<apex:page standardController="Inventory__c">
    {!Inventory__c.Quantity__c}
</apex:page>

You may want to take the trailhead that covers the basics of Visualforce. Many of the questions that you'd have as a beginner are covered in this trailhead.

2
  • Thanks for the reply! So in general, the usual syntax is: {!<name of object>.<header of column>} Am I correct?
    – Frankg26
    Aug 29, 2017 at 23:30
  • @Frankg26 Yes, that's the general rule. It gets more complicated than that, so I provided a link to the Trailhead for you. I recommend that you go through it, it's worth your time.
    – sfdcfox
    Aug 29, 2017 at 23:41

You must log in to answer this question.

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