Skip to content

Instantly share code, notes, and snippets.

trigger AccountTrigger on Account (after update) {
// make a set of all account ids that are not active but previously were active
Set<Id> accountsSetToInactive = new Set<Id>();
for(Account acc : trigger.new) {
if(!acc.Active_Checkbox__c && trigger.oldMap.get(acc.Id).Active_Checkbox__c) {
accountsSetToInactive.add(acc.Id);
}
}