Wednesday 18 June 2014

How to permanently delete record from data base.

As we all know if we delete records from our org. It will be stored in recycle bin for 15 days. We can go to recycle bin and delete manually. 
Suppose the requirement is when we delete records those records should be deleted from recycle bin.
For this requirement we have to write a trigger on object. 

trigger todelteRecordPermanent on Account (after delete) {
    list<Id> Ids = new list<Id>();
    for(Account  account: Trigger.old){
        Ids.add(account.id);  
    }
    Database.emptyRecycleBin(ids);
}

No comments: