Apex Trigger
trigger DeleteInactiveAccounts on Account (after update) {
Set<Id> inactiveAccountIds = new Set<Id>();
for (Account account : Trigger.new) {
if (account.Active__C != Trigger.oldMap.get(account.Id).Active__C && account.Active__C =='No') {
inactiveAccountIds.add(account.Id);
}
}
delete [SELECT Id FROM Account WHERE Id IN :inactiveAccountIds];
}
Explanation
This trigger first gets the IDs of all accounts that are being set as inactive (i.e., their Active__c field is being changed from Yes to No ). Then, it deletes these accounts from the database.
Video
Video does not exists.