function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mila JohnsonMila Johnson 

Check my trigger.

Hello all,

Need some help on this trigger please. Created a custom setting to bypass user for this trigger.

trigger Deleteaccount on Account (before delete) {
    
        Automation_Processes__c Automation = Automation_Processes__c.getInstance(UserInfo.getUserId());
        
        
    if(!Automation.Bypass_Account_Deletion_trigger__c){
       return;
        }
        
    System.debug(' accountdeleteTrigger');
    for(Account acc : trigger.old){
            acc.adderror('Account Cannot be deleted');
    }

    
}
Maharajan CMaharajan C
Hi Mike,

There is no problem in your code.

Check your custom setting record... Is it marked as true or false... It should be false then your trigger will bypass...

Thanks,
Maharajan.C
Maharajan CMaharajan C
Sorry Mila, I mentoned your name wrongly...