function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RyanhRyanh 

How do I remove a button from a related list on a VF page

I'm adding a related list to custom VF page, but I want to remove the "New xyz" button from the list. I removed the button from the list on the standard page layout, but that had no impact.
xnerd00xxnerd00x

I believe that should do the trick, but I'm a VF newb.  You can do pageBlockTable like this:

 

<apex:pageBlock title="Schedule"> <apex:pageBlockTable value="{!OpportunityLineItem.OpportunityLineItemSchedules}" var="sch"> <apex:column value="{!sch.ScheduleDate}"/> <apex:column value="{!sch.Revenue}"/> <apex:column value="{!sch.Description}"/> </apex:pageBlockTable> </apex:pageBlock>

 

 

 

JimRaeJimRae
I think xnerd is probably right.  The easiest way would be to simulate the related list with a pageblocktable instead of the "relatedlist" component. 
Lavanya TangatiLavanya Tangati
You can use <apex:facet>

<apex:relatedList list="OpportunityContactRoles">
  <apex:facet name="header">Contact Roles</apex:facet>
</apex:relatedList>

this should override the button