• scenario: Before Delete Trigger in Salesforce

    Published By: Venu Gutta
    Published on: Tuesday 21 March 2017
    A- A+
    Before Delete Triggers basically used for preventing the record deletion based on some condition.

    Scenario: Write a Trigger on Account to prevent the record delete, if Annual Revenueis grater than or equals to 50,000. If Annual Revenue is more than fifty thousand it should throw error.


    trigger DeleteTrigger on Account (Before Delete) {
           for(account a: trigger.old){
                   a.adderror(' You cant delete if "Annual Revenue is more than 50000" ');


    If I try to delete Account Record which has more than 50,000 then it shows Validation Errors While Saving Record(s) like below

  • No Comment to " scenario: Before Delete Trigger in Salesforce "