You need to sign in to do that
Don't have an account?
Zimmer
Task Trigger to Update Date/Time field on Lead
I have written this trigger and it works great to store the first human generated activty date from the task to the lead record.
trigger ActivityFirstcontact on Task (after insert) {
List<Lead> updatedLeads= new List<Lead>();
for(Task newTask:Trigger.new){
if(string.valueOf(NewTask.WhoId).startsWith('00Q') && newTask.Subject != 'Lead Source Details')
updatedLeads.add(new Lead(Id=newTask.WhoId, First_Contact_Date_Time__c=newTask.CreatedDate));
}
update updatedLeads;
}
I am attempting to modify the code to only write to the field
First_Contact_Date_Time__c
when the field is blank. How can i update the code to manage this. Anytime I attempt to lookup the lead using the whoid i get errors.
Thoughts?
ok i fixed it myself and figured i would update this post for future people.
All Answers
ok i fixed it myself and figured i would update this post for future people.
Thanks for posting. I was able to manipulate the variables to solve a similar problem.