Last active
March 14, 2016 17:31
-
-
Save mkorman/041913128f417bc91848 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
trigger CreateFollowupTask on Lead (after insert, after update) { | |
List <Task> followupTasks = new List <Task> (); | |
for (Lead newLead : trigger.new) | |
{ | |
if (newLead.isConverted) continue; | |
if (newLead.Status == 'Open - Not Contacted') { | |
Task newTask = new Task ( Subject = 'Intial call', Type = 'Call', ActivityDate = Date.Today().AddDays(2), | |
Status = 'Not Started', whoId = newLead.Id); | |
followupTasks.Add (newTask); | |
} | |
else if (newLead.Status == 'Working - Contacted') { | |
Task newTask = new Task ( Subject = 'Send email', Type = 'Email', ActivityDate = Date.Today().AddDays(7), | |
Status = 'Not Started', whoId = newLead.Id); | |
followupTasks.Add (newTask); | |
} | |
} | |
insert followupTasks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment