before update trigger salesforce code example
Example: 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.');
}
}
}
}