Skip to content

Instantly share code, notes, and snippets.

@TheShubhamVsnv
Created January 17, 2024 07:49
Show Gist options
  • Save TheShubhamVsnv/e656583510780095864a8f6eb40828f7 to your computer and use it in GitHub Desktop.
Save TheShubhamVsnv/e656583510780095864a8f6eb40828f7 to your computer and use it in GitHub Desktop.
// Apex Class with Static Set of IDs
public class TriggerHandler {
private static Set<Id> processedRecords = new Set<Id>();
public static void onBeforeUpdate(List<Account> newAccounts) {
for (Account acc : newAccounts) {
if (!processedRecords.contains(acc.Id)) {
// Your logic here
acc.Name = 'Updated Name';
// Continue with your processing
// Add the record ID to the set to track processed records
processedRecords.add(acc.Id);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment