Last active
December 23, 2015 21:39
-
-
Save noeticpenguin/6698094 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Class ContactTriggerLogic Extends TriggerHandler { | |
Map<Id,Account> newMap; | |
Public ContactTriggerLogic() { | |
this.newMap = (Map<Id, Account>) Trigger.newMap; | |
} | |
Public Contact addSnark(Contact c){ | |
if(!c.lastName.contains(' is awesome!')){ | |
c.lastName = c.lastName + ' is awesome!'; | |
} | |
return c; | |
} | |
Public override void beforeInsert() { | |
for(Contact c : newMap.values()){ | |
addSnark(c); | |
} | |
} | |
//if your trigger definition included before update you could include | |
Public override void beforeUpdate() { | |
for(Contact c : newMap.values()){ | |
addSnark(c); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment