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
sfdc guy.ax723sfdc guy.ax723 

StandardSetController Save Method

I have the following page that is called from a Button on a list view.

 

<apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity">
    <apex:form >
        <apex:sectionHeader title="Opportunity Management" subtitle="Mass Edit Opportunities (Beta)"/>
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selected}" var="opp">
                <apex:repeat value="{!$ObjectType.Opportunity.FieldSets.OpportunityMassEditFieldSet}" var="f">
                    <apex:column headerValue="{!$ObjectType.Opportunity.Fields[f].label}"><apex:inputField value="{!opp[f]}" /></apex:column>
                </apex:repeat>
            </apex:pageBlockTable>      
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

The page displays properly and when I click save the Opportunities that were displayed save correctly. However it appears that when the save occurs, the records are saved one at a time rather than saving multiples at at time.

 

It looks like the controller executes in the following manner:

 

for (Opportunity x : opportunities){

     update x;

}

 

raher than

 

update opportunities;

 

Can someone confirm if this is the expected behavior?

 

Thanks sfdc guy