You need to sign in to do that
Don't have an account?
birdofprey
mass update only the record that has a change
So I have more than one row of record being diplay in VF where they can be edited, but I would only like to edit the record that has changes, as opposed to every record displayed.
Would I have to iterate through each record and do a search to see if each field is different and if so, then update the record of those that had a change?
here is sample mock of what I currently have
public class manageEventController { List <Team__c> team, team2; public List<Team__c> getTeam(){ team = [SELECT Id, Name, Campaign__c, Account__c, Team_Type__c, Pre_Registration_Size__c, Recruiting_Goal__c, Annual_Event_Type__c FROM Team__c LIMIT 3]; return team; } public PageReference cancel() { PageReference Page = ApexPages.currentPage(); Page.setRedirect(true); return Page; } public PageReference save() { update team; system.debug('debug--->' + team); PageReference Page = ApexPages.currentPage(); Page.setRedirect(true); return Page; } }
either use a trigger. It would pass only those values which have changed in Trigger.New and u ned to work with them .
Else use a field as IsChanged and using javascript set the value as true. then passing values server side you can check for those records which have isChanged as true. after complete operation set the value as false again