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
iswarya sekar 7iswarya sekar 7 

mass update records in list view

when i enter value for amount field, that value should be updated in all records of a list view.
can anyone please help me on this. 
im in urgent. its a client requirement.
iswarya sekar 7iswarya sekar 7
<apex:page standardController="Opportunity" recordSetVar="opplist" showHeader="true" extensions="updateoppclass">
    <apex:pageMessages />
    <apex:form >
        <apex:pageBlock title="Step 1 - list of opportunities">
            <apex:pageBlockTable value="{!opplist}" var="a1">
                <apex:column value="{!a1.Name}"/>
                <apex:column value="{!a1.stagename}"/>
                <apex:column value="{!a1.Amount}"/>
                <apex:column value="{!a1.CloseDate}"/>
                <apex:column value="{!a1.probability}"/>
                <apex:column value="{!a1.Account.name}"/>
             </apex:pageBlockTable>
            
            <apex:pageblockbuttons >
                <apex:commandButton value="Cancel" onclick="return confirmCancel()"/>
                <apex:commandButton value="next" action="{!gotoVF}"/>
            </apex:pageblockbuttons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

<apex:page standardController="Opportunity" extensions="displayvalues">
    <apex:form>
        <apex:pageMessages/>
        <apex:pageblock title="Step 3- enter the new value for the field:">
          value: &nbsp; <apex:inputField value="{!opportunity.Name }" required="false"/>
        <apex:pageblockbuttons>
            <apex:commandButton value="previous" action="{!gotoVF}"/>
            <apex:commandButton value="update" action="{!saveAndRedirect}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageblockbuttons>
            </apex:pageblock>
    </apex:form>
</apex:page>
 
public class updateoppclass {
    
    public updateoppclass(ApexPages.StandardSetcontroller controller){
    }
    public PageReference gotoVF(){
        PageReference pref=New PageReference('/apex/Step2page');
        pref.setRedirect(True);
        return pref;
    
    }
    
}

public with sharing class displayvalues {
    public opportunity caseRecord { get; set; }
    public displayvalues(ApexPages.Standardcontroller controller){
    } 
public List<opportunity> myAccounts;
        public Boolean isEditEnabled;
    public displayvalues(){
        myAccounts = new List<opportunity>();
                isEditEnabled = false;
    }
 public List<opportunity> getMyAccounts(){
        myAccounts = [select Id,name, stagename, amount from opportunity WHERE (owner.id =: userinfo.getuserid())];           
        return myAccounts;          
    } 
    public PageReference saveAndRedirect() { 
        update myAccounts;               
        return null;   
    }
    public PageReference gotopage1(){
        PageReference pref2=New PageReference('/apex/oppupdatepage');
        pref2.setRedirect(True);
        return pref2;
    }
     public PageReference gotoVF(){
        PageReference pref=New PageReference('/apex/Step2page');
        pref.setRedirect(True);
        return pref;
    
    }
    public PageReference step3(){
        PageReference pref2=New PageReference('/apex/entervalues');
        pref2.setRedirect(True);
        return pref2;
    }
    
    public List<selectOption> oppflds;
  //  public displayvalues(){}
        public List<selectOption> getOppNames() {
            oppflds = new List<selectOption>();
            oppflds.add(new selectOption('--none--','--none--'));
            Schema.DescribeSObjectResult opp_desc = Opportunity.sObjectType.getDescribe();
            Map<String, Schema.SObjectField> opp_fields = opp_desc.fields.getMap();
            for(Schema.sObjectField fld:opp_fields.values())
            {
                    String oppfldName = String.valueOf(fld);
                    oppflds.add(new selectOption(oppfldName,oppfldName));
            }
            System.debug('stdObjectNames: ' + oppflds);
            return oppflds;
        }
}
 
<apex:page standardController="opportunity" extensions="displayvalues">
    <apex:form > 
        <apex:pageblock title="Step 2 - Select the field to be updated">
            <span>Fields: </span>
            <apex:selectList multiselect="false" size="1">
                <apex:selectOptions value="{!OppNames}">
                </apex:selectOptions>
            </apex:selectList>
            
            <apex:pageblockbuttons >
                <apex:commandButton value="previous" action="{!gotopage1}"/>
                <apex:commandButton value="Next" action="{!step3}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageblockbuttons>
        </apex:pageblock>
    </apex:form>
        
</apex:page>

 
iswarya sekar 7iswarya sekar 7
here, when i select amount field to be updtaed, i need to enter the new value for that field in step3(new VF pge). so that new value should be updated in all records of list view. please please help me.
iswarya sekar 7iswarya sekar 7
Can anyone help me on this?