Last active
August 29, 2015 14:14
-
-
Save practicalli-johnny/784aabd6b76e11b4dbac to your computer and use it in GitHub Desktop.
Trigger to restrict contact by last name
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 RestrictContactLastName on Contact (before insert, before update) { | |
// Prevent updating or inserting a Last Name to the value of 'INVALIDNAME' in a Contact record | |
For (Contact contact : Trigger.New) { | |
if(contact.LastName == 'INVALIDNAME') { | |
contact.AddError('The Last Name "'+contact.LastName+'" is not allowed for Contact records'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment