after delete in salesforce code example

Example 1: salesforce delete apex job

List<CronTrigger> JOBIDLIST = new List<CronTrigger>();
JOBIDLIST = [select id from CronTrigger];
for(CronTrigger job:JOBIDLIST )
{
   System.abortJob(job.id);
}

Example 2: before delete trigger in salesforce

trigger AccountTrigger on Account (before delete) 
{ 
   if(System.Trigger.IsDelete)
   { 
     for (Account acc : trigger.old)
  {
    if (String.isNotBlank(acc.Client_ID__c))
     { 
  acc.addError('You cannot delete This Account Please contact your Salesforce.com Administrator for assistance.');
     }
         } 
   }
 }

Tags:

Misc Example