Activity Forums Salesforce® Discussions How to prevent a Salesforce record from being deleted in account object when rating is set to hot? Reply To: How to prevent a Salesforce record from being deleted in account object when rating is set to hot?

  • Shaharyar

    Member
    August 21, 2017 at 6:19 am

    trigger preventDeletionAccount on Account (before delete) {
    List<Account> acc=new List<Account>();
    for(Account acc:trigger.old)
    {
    if(acc.Rating=='Hot'){
    acc.addError('Prevents Deletion');
    }
    }
    }