Last active
February 22, 2019 17:55
-
-
Save lfreeland/18fd5691ad3ba61f1001cc4815c0613f to your computer and use it in GitHub Desktop.
Simple Trigger Framework Insert Validation Handler Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class AccountTriggerHandler extends TriggerHandlerBase { | |
protected override void beforeInsert(List<Sobject> newRecords) { | |
List<Account> newAccounts = (List<Account>) newRecords; | |
for (Account newAcct : Trigger.new) { | |
if (newAcct.Name == ‘bad’) | |
newAcct.addError(‘Bad Name’); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment