function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bkk130bkk130 

Help adding a custom list button to redirect to my visualforce page

I am trying to call a Visualforce page from a custom list button. I can't seem to get this to work. 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. How can I get my visualforce page to appear in the dropdown menu so that I can add the button to my related list page? Here is my current code:

 

public class multiInsuranceInsert{

    public PageReference next() {
        PageReference home = new PageReference('https://c.na1.visual.force.com/apex/multiInsuranceInsert');
        home.setRedirect(true);
       return Page.multiInsuranceInsert;
   }
    public List<Action_Plan__c> ip {get; set;} 
    public multiInsuranceInsert(){
        ip = new List<Action_Plan__c>();
        ip.add(new Action_Plan__c());
    } 
    public void addrow(){
        ip.add(new Action_Plan__c());
    }
        public PageReference save(){
        insert ip;
        PageReference home = new PageReference('https://na1.salesforce.com/a03/o');
        home.setRedirect(true);
        return home;
    }
    public PageReference cancel(){
        PageReference home = new PageReference('https://na1.salesforce.com/a03/o');
        home.setRedirect(true);
        return home;
    }
 }

 

 

<apex:page standardcontroller="multiInsuranceInsert" tabStyle="Action_Plan__c" showHeader="true">

<apex:sectionHeader title="Development Plans" subtitle="Mass Create Insurance Plan" />
Select employees to create a Insurance Plan for:
    <apex:form >
        <apex:pageBlock >
       
            <apex:pageBlockButtons > 
                <apex:commandButton value="Save" action="{!save}" rerender="error"/>  
                <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
                <apex:commandButton action="{!next}" value="Next"/>
            </apex:pageBlockButtons> 
                          
            <apex:pageBlockTable value="{!ip}" var="a" id="table">
                <apex:facet name="footer">
                    <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error"/>
                </apex:facet>
                <apex:column headerValue="Name">
                    <apex:inputField value="{!a.Employee__c}" required="true"/>
                </apex:column>
                <apex:column headerValue="Insurance Plan">
                    Investments/Financing
                </apex:column>    
                <apex:column headerValue="Establish Insurance Discipline">
                    <apex:inputField value="{!a.Establish_investment_discipline__c}" required="false"/>
                </apex:column> 
                <apex:column headerValue="Respond to incoming calls">
                    <apex:inputField value="{!a.Respond_to_Incoming_Calls__c}" required="false"/>
                </apex:column> 
                <apex:column headerValue="Document Client Interactions">
                    <apex:inputField value="{!a.Document_Client_Interactions__c}" required="false"/>
                </apex:column> 
                <apex:column headerValue="Define philosophy & process">
                </apex:column>                  
            </apex:pageBlockTable>
           
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

aballardaballard

To be allowed for use on a custom button, the page must use the standard controller for the object on which you are creating the button.   You can add custom apex code as an extension if you need it.  But the controller must be standardController.