How to call a visualforce page from a custom button?

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?



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="{!}"/>
            <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

Source : Link , Question Author : user2333346 , Answer Author : Sergej Utko

Leave a Comment