0

enter image description here

when i am updating a checkbox using record page a trigger is running on update which is deleting the recently updated records. The trigger is running fine but after deleting a record its showing me above error how can i fix that

2
  • Please use Debug Logs to debug what exact error you are getting.
    – Sneh
    May 4, 2022 at 6:31
  • the apex code is running without error. I guess its because the current record page cannot access the current record as its deleted by the trigger May 4, 2022 at 7:02

1 Answer 1

0
  • Trigger
Trigger AccountTrigger on Account (Before Delete){
    if(Trigger.isDelete){  
 AccountClassDemo1.beforeMethod(Trigger.Old)
    }
}
  • Apex

AccountClassDemo1

public class AccountClassDemo1{
    public static void beforeMethod(List<Account> newList){
        for(Account acc: newList){
            if(acc.Active==true){
                acc.adderror('Not Deleted');
            }
        }
    }
}
1
  • So what will be better when applying your solution? Sep 2, 2022 at 6:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .