+ Start a Discussion
Scott.DivishScott.Divish 

Recreate Price Books related list on Products using Visualforce

I'm trying to mimic the standard Price Books related list on the Product object using visualforce page.  I'm new to Visualforce and can't seem to find where I would be able to limit what price book displays in my page.  On the standard Price Books related list, it doesn't list the "Standard Price Book"...which is what I like.  However, when I recreate this related list into a Visualforce page it draws in the standard price book...and I don't want that.

Price Books Related List

NOTE: the reason I'm trying to recreate this list is because the standard related list isn't editable and I want to pull in a custom field "Service Price" to display next to List Price.
Here is the simple code I'm using to try and mimic this.
<apex:page id="PriceBookEntries" standardController="Product2">
        <base target="_parent"/>
    <apex:pageBlock >
    <apex:pageBlockSection >
        <apex:pageBlockTable value="{!Product2.PricebookEntries}" var="pricebookentry" >
            <apex:column headervalue="Price Book Name">
                <apex:outputText value="{!pricebookentry.Pricebook2.Name}"/>
            </apex:column>
            <apex:column headervalue="List Price">
                <apex:outputText value="{0, number, Currency}">
                        <apex:param value="{!pricebookentry.UnitPrice}" />
                </apex:outputText>
            </apex:column>
            <apex:column headervalue="Service Price">
                <apex:outputText value="{0, number, Currency}">
                        <apex:param value="{!pricebookentry.Service_Price__c}" />
                </apex:outputText>
            </apex:column>
            <apex:column headervalue="Active">
                <apex:outputfield value="{!pricebookentry.Pricebook2.IsActive}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>