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

Edit multiple records with a list controller extension

I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

You need to exclusively save the collection in your controller class as you are not using default collection given by recordSetVar definiing a new method or overriding the Save method in controller class
<apex:page standardController="Opportunity" recordSetVar="opportunities" extensions="OppsExtension">
    <apex:pagemessages ></apex:pagemessages>
    <apex:pageBlock title="Viewing Opps">
        <apex:form id="theForm">
            <apex:pageBlockSection >
                <apex:pageblockTable value="{!Opportunities}" var="opp">
                    <apex:column value="{!opp.Name}"/>
                    <apex:column >
                        <apex:inputfield value="{!opp.StageName}"/>
            <apex:panelGrid columns="2">
                <apex:commandLink action="{!previous}">Previous</apex:commandlink>
                <apex:commandLink action="{!next}">Next</apex:commandlink>
                <apex:commandButton action="{!save}" value="Save"/>

public with sharing class OppsExtension {
    public ApexPages.StandardSetController OppRecords{
        get {
            if(OppRecords == null) {
                OppRecords = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Name, StageName FROM Opportunity WHERE AccountId=:ApexPages.currentPage().getParameters().get('id') ]));
            return OppRecords;
        private set;
    public OppsExtension(ApexPages.StandardSetController controller) {

    public List<Opportunity> getOpportunities(){
        return (List<Opportunity>)OppRecords.getRecords();
    public Pagereference save(){;
        return null;