I have the following VisualForce page:

<apex:page standardController="Inquery__c" 

    "First Name","Last Name","Email","Qualification"

    <apex:repeat value="{!accvar}" var="a">
        <apex:outputText rendered="{!NOT(a.Download__c)}">
            {!a.First_Name__c}, {!a.Last_Name__c}, {!a.Email__c}, {!a.Quilification__c}


That downloads all the records in a CSV file, That have the check box field Download__c unchecked.

How can I call this VF from a custom button on the Inquery__c custom object?

When I choose the Content Source as Visualforce Page, No content is available!

What am I doing wrong?


2 Answers 2


Use a javascript for that:

window.location = 'apex/YourVisualforcePage';

This is my example of the button:

enter image description here

And the visualforce page:

<apex:page standardController="Account" recordSetVar="accounts">
        <apex:pageBlockTable value="{!accounts}" var="a">
            <apex:column value="{!a.name}"/>
            <apex:column value="{!a.CustomerPriority__c}"/>

Here is the result page:

enter image description here

And here is an screenshot of the account page and the result of the click on the button:

enter image description here

Now add the button to the object page layout. Go to some of the object records page, find a lind called Edit Layout and click on it:

enter image description here

Now drag your button to the page and drop it in to the Custom buttons area, then save the layout:

enter image description here

  • What's the best practice for doing this from LEX, now that the window object is taken away and OnClick JS buttons are disabled? Commented Aug 28, 2017 at 20:22
  • 1
    Yea this answer is only applicable to Salesforce Classic not LEX
    – compski
    Commented Nov 21, 2018 at 4:47

If you want it in Lightning experience you can do in this way.

1) Create a VF page


2) Create a New Button or Link as Detail Page button , Content source as the above VF page.

3) And add the button to the custom button to the Page Layout

You must log in to answer this question.

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