Skip to content

Instantly share code, notes, and snippets.

@joshbirk
Last active August 29, 2015 14:08
Show Gist options
  • Save joshbirk/1459ce3a17c7f16cdc70 to your computer and use it in GitHub Desktop.
Save joshbirk/1459ce3a17c7f16cdc70 to your computer and use it in GitHub Desktop.
trigger RestrictContactByName on Contact (before insert, before update) {
//check contacts prior to insert or update for invalid data
For (Contact c : Trigger.New) {
if(c.LastName == 'INVALIDNAME') { //invalidname is invalid
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment