You need to sign in to do that
Don't have an account?
Help adding a custom list button to redirect to my visualforce page
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>
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.