[SalesForce] How to display a Related List in a Visualforce page

Can any one help me out ?I'm Creating an OpportunityLineItem(Opportunity Product) page in Visualforce page and now how should i call the related list(Schedule) fields to get display in Visual Force pages .Any Suggestions

Here is the Code :

<apex:page standardController="OpportunityLineItem" sidebar="false" showHeader="false">
    <apex:form>

        <apex:pageBlock title="Opportunity Product">
            <apex:pageBlockButtons location="Top">
                <apex:commandButton value="Edit" />
                <apex:commandButton value="Delete" />
            </apex:pageBlockButtons>

            <apex:pageBlockSection title="Opportunity Product Detail">
                <apex:inputField value="{!OpportunityLineItem.Opportunity.Name}" />
                <apex:inputField value="{!OpportunityLineItem.Product2.Name}" />
                <apex:inputField value="{!OpportunityLineItem.ProductCode}" />
                <apex:inputField value="{!OpportunityLineItem.ListPrice}" />
                <apex:inputField value="{!OpportunityLineItem.UnitPrice}" />
                <apex:inputField value="{!OpportunityLineItem.Quantity}" />
                <apex:inputField value="{!OpportunityLineItem.ServiceDate}" />
                <apex:inputField value="{!OpportunityLineItem.TotalPrice}" />
                <apex:inputField value="{!OpportunityLineItem.Description}" />
            </apex:pageBlockSection>
        </apex:pageBlock>

        <apex:pageBlock title=" Schedule">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Edit" />
                <apex:commandButton value="Delete" />
                <apex:commandButton value="Re-Establish" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection>
                <!--<apex:inputField value="{!OpportunityLineItemSchedule.Date}"/>-->
            </apex:pageBlockSection>
        </apex:pageBlock>

    </apex:form>
</apex:page>

Best Answer

Try using apex tag

<apex:relatedList>

Refer this documentaion for details.

Related Topic