0

I want to place a custom button on the Opportunity detail page. this button if clicked will pop all the record data into a excel sheet.

how do i approach this, i know how to export with content type and linking it to a button with pagereference, but i have tried all that in VF pages with custom controller only.

for opportunity, how do i create a button and place it and then link it to a vf page that exports all the data to excel sheet.

Thanks

2 Answers 2

1

Here is the link you can follow:

http://www.sfdcpoint.com/salesforce/export-excel-using-visualforce-page/

This example is for Account standard object. You just create the similar page for Opportunity and then create a button by going to:

  1. Go to Setup --> Opportunities --> Buttons, Links and actions.
  2. Click New Button or Link.
  3. Follow the below Screenshot, and don't forget to get the button on layout.

enter image description here

3
  • Thanks, I was told to do this, i was thinking of doing with VF. 1.Create a VF with apex detail to display all opportunity details 2.Create another VF which will export all data to excel,with contenttype help. 3.Create a controller class which will pagereference the second VF page when the button is clicked on. This was my first approach but the issue with this was that I cant use both standard and custom controller on top and i cant do both right. Just think if you had to do this with all VF,is my above thinking steps right although just missing some steps to include both controllers?
    – Niknit
    Jun 1, 2017 at 13:14
  • why can't you use both? You can definitely use standardController with extension(custom controller class). developer.salesforce.com/page/… Jun 1, 2017 at 13:42
  • if the above answer has helped you to get an idea of your solution, then select it as answer, it will help other members in future. Jun 1, 2017 at 14:07
0

Create a VF page with a controller that start the export process.

Then in the opportunity "buttons, links and actions" section create a "new button" for "Detail Page". Select your preferred opening behaviour.

Select source = "URL"

In the formula enter: {!URLFOR('/apex/YOUR_VF_PAGE_NAME?id=' + Opportunity.Id)}

Of course replace with the proper VF page name

2
  • When i select visualforce page in the content source multipicklist , there is no formula box to enter, it is only available for the URL option in the content source. thanks
    – Niknit
    Jun 1, 2017 at 13:03
  • Right, select URL, forgot that step and added it.
    – Christoph
    Jun 1, 2017 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .