Created
September 28, 2016 21:31
-
-
Save AlwaysThinkin/c68303bf6e14a859f0d34a34824c77a5 to your computer and use it in GitHub Desktop.
Revisions
-
AlwaysThinkin revised this gist
Sep 28, 2016 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
AlwaysThinkin created this gist
Sep 28, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ public class ContactAfterInsert { public static void setContactDeptIT(List<Contact> cons){ List<Contact> consToUpdate = new List<Contact>(); for(Contact conInTrigger : cons){ Contact c = new Contact(Id = conInTrigger.Id, Department = 'IT'); consToUpdate.add(c); } update consToUpdate; } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ Trigger ContactAfterTrigger on Contact (after insert) { ContactAfterInsert.setContactDeptIT(trigger.new); /*Logic Moved to ContactAfterInsert class List<Contact> consToUpdate = new List<Contact>(); for(Contact conInTrigger : trigger.new){ Contact c = new Contact(Id = conInTrigger.Id, Department = 'IT'); consToUpdate.add(c); } update consToUpdate; */ }