-
-
Save TheShubhamVsnv/48f6da3099cd84ed4fef099b9d45b8ff to your computer and use it in GitHub Desktop.
Throw Error when user tries to delete the contact without account
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 ContactBeforeDelete on Contact (before delete) { | |
for( contact con : trigger.old) | |
{ | |
if( con.accountId == null) | |
{ | |
con.addError('Hey !!! you are not authrized to delete this contact'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment