[SalesForce] How to display custom fields in Visual Force

<apex:page standardController="Lead">
  <apex:form >
    <apex:tabPanel >
        <apex:tab label="Collect Loan Package" labelWidth="200">
           <apex:PageBlock >
            <apex:pageBlockSection columns="1" collapsible="false">
               <apex:pageBlockSectionItem>
//Please help me find a way to display custom fields!!!                   
 *<apex:outputLabel value="{!$ObjectType.Lead.fields.Interim_Financials_Statements__c}"/>*

……Didnt copy and paste the whole block.

Best Answer

A single field in this context where you want to pick your own label would be:

<apex:pageBlockSectionItem>
    <apex:outputLabel value="{!$ObjectType.Lead.fields.Interim_Financials_Statements__c}"/>
    <apex:outputField value="{!Lead.Interim_Financials_Statements__c}"/>
</apex:pageBlockSectionItem>

but as you are picking the standard label that will be output with just this:

<apex:outputField value="{!Lead.Interim_Financials_Statements__c}"/>

So the syntax is the SObject reference name (Lead in this case) dot the API name of the custom field (assuming Interim_Financials_Statements__c in this case) wrapped in the Visualforce expression delimiters {! }.

Related Topic