+ Start a Discussion
AxxxVAxxxV 

Prevent undelete operation using trigger

How can I restrict an ability to restore records froma Recycle Bin?

I tried the following code it did not work. This is for 'after undelete' trigger. The 'before undelete' is not supported as far as I can see.


Code:
if(Trigger.isUndelete){ 
 for(SCS_Client_Time_Series__c clts : Trigger.old){
  clts.addError('Not allowed to restore Time Series from Recycle Bin. Create new Time Series record instead.');
 }

}

 

Yossi 4Yossi 4
B"H

You can try to delete in the trigger or in a @future call