2

I am trying to call a Visualforce page from a custom list button. I have done this successfully from a detail page button by creating a page using a standard controller for the detail object, selecting Visualforce page as the content source and then picking the page I wanted from the pull down list for content.

However, I can't seem to get this to work for a list button. I pick the list button option on the custom button or link page, and pick visualforce page for the content source, but I don't get my visualforce page to appear in the content pull down list.

4

You need to use recordSetVar on your page to make it available for custom List view button.

<apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity" extensions="tenPageSizeExt">
    <apex:form >
        <apex:pageBlock  title="Edit Stage and Close Date" mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selected}" var="opp">
                <apex:column value="{!opp.name}"/>
                <apex:column headerValue="Stage">
                    <apex:inputField value="{!opp.stageName}"/>
                </apex:column>
                <apex:column headerValue="Close Date">
                    <apex:inputField value="{!opp.closeDate}"/>
                </apex:column>
            </apex:pageBlockTable>      
        </apex:pageBlock>
    </apex:form>
    </apex:page>

Adding Custom List Buttons using Standard List Controllers

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.