Do you know if i can add a custom button on product section on opportunity?That is near the buttons ADD PRODUCT_CHOOSE PROCE BOOK_SORT

To solve this I have created a List custom button (OpportunityProduct---->Buttons and Links). After I have added it to the page layout. I am not able to select my VF page.Take a Look: enter image description here

This is my controller in the vf page: standardController="Opportunity" extensions="tempsection3" I have the same problem if i add standardController="OpportunityLineItem".

Thank you in advantage.



Firstly, create a List Button under App Setup > Customize > Opportunities > Opportunity Products > Buttons and Links. Uncheck "Display Checkboxes (for Multi-Record Selection)", as last time I checked you can't have list controllers for OpportunityLineItem.

List Button

Then, when editing the Opportunity page layout click the small spanner above the products related list. The Buttons section can be a bit hard to find and will need to be expanded up from the button of the dialog. From there you can add your new button.

Related List Properties

UPDATE Linking to a Visualforce Controller

You can't use a custom visualforce page against a non top-level standard object. See StandardController recordSetVar OpportunityLineItem issue (my emphasis)

Yes we restrict list controllers ( standardCOntroller + recordSetVar attribute) to only top-level standard and custom objects so effectively you can not create a list button to a Visualforce page for OpportunityLineItem today. - Andrew, Product Manager - salesforce.com

Instead, you can set the Content Source to URL and point the URL at your Visualforce page.

List Button to redirect to Visualforce page

  • I have updated my question!Please can you take a look.Thank you – Enry May 17 '13 at 10:18
  • Thank you very much Daniel!Great solution with the URL. ;) – Enry May 18 '13 at 7:24

A VF page with the standard Opportunity controller can be placed on the OpportunityLineItem related list. You may need to do some Apex gymnastics to get all the OpportunityLineItem records for that Opportunity, but (Opportunity)controller.getRecord() will pull the Opportunity itself.

  • Really? I tried creating a custom button on Opportunity but I couldn't add that to the OpportunityLineItem related list... Does it still work on your side? – Willem Mulder Dec 23 '14 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.