Skip to content

Instantly share code, notes, and snippets.

@AlwaysThinkin
Last active June 15, 2019 13:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AlwaysThinkin/32b8727218e02b72b5654740d905a435 to your computer and use it in GitHub Desktop.
Save AlwaysThinkin/32b8727218e02b72b5654740d905a435 to your computer and use it in GitHub Desktop.
public class ContactBeforeInsert {
public static void setContactTitle(List<Contact> cons){
for(Contact c : cons){
c.Title = 'Admin';
}
}
}
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