Posts

Showing posts with the label Mass Update

Mass Updating Records with a Custom Controller Using Visualforce Page

Here's an example illustrating these steps: Controller public with sharing class MassUpdateController {     public List<MyObject__c> records { get; set; }     public Set<Id> selectedIds { get; set; }     public MassUpdateController() {         // Fetch records to display         records = [SELECT Id, Name, Active__c FROM Agent__c LIMIT 10];         selectedIds = new Set<Id>();     }     // Method to handle the mass update operation     public PageReference performMassUpdate() {         List< Agent__c > recordsToUpdate = new List< Agent__c >();         // Fetch selected records to update         for (Agent__c record : records) {             if (selectedIds.contains(record.Id)) {                 // ...