Last active
June 15, 2019 13:38
-
-
Save AlwaysThinkin/32b8727218e02b72b5654740d905a435 to your computer and use it in GitHub Desktop.
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
public class ContactBeforeInsert { | |
public static void setContactTitle(List<Contact> cons){ | |
for(Contact c : cons){ | |
c.Title = 'Admin'; | |
} | |
} | |
} |
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 ContactBeforeTrigger on Contact (before insert) { | |
ContactBeforeInsert.setContactTitle(trigger.new); | |
/* Moved the logic to ContactBeforeInsert class | |
* for(Contact c : Trigger.new){ | |
c.Title = 'Admin'; | |
} | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment