Last active
February 22, 2019 17:01
-
-
Save lfreeland/53a1055e7f59c791fec6cd52c45c9153 to your computer and use it in GitHub Desktop.
Insert Trigger Validation 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
trigger myAccountTrigger on Account (before delete, before insert) { | |
if (Trigger.isBefore) { | |
if (Trigger.isInsert) { | |
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