-
-
Save TheShubhamVsnv/f04c68c23e161dc156062c7c61232352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class UpdateAccountNames implements Database.Batchable<sObject> { | |
global Database.QueryLocator start(Database.BatchableContext BC) { | |
// Collect batches of Account records to be processed | |
String query = 'SELECT Id, Name FROM Account'; | |
return Database.getQueryLocator(query); | |
} | |
global void execute(Database.BatchableContext BC, List<Account> accList) { | |
// Process each batch of records | |
for(Account acc : accList) { | |
// Update the Account Name | |
acc.Name = acc.Name + ' - Updated'; | |
} | |
// Update the Account records | |
update accList; | |
} | |
global void finish(Database.BatchableContext BC) { | |
// Perform post-processing operations if needed | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment