You need to sign in to do that
Don't have an account?
Son H
Capture first Activity of Lead error "Variable does not exist: WhoId
I am new to coding and saw this code to capture the date of the first Activity of a Lead. I keep on receving this issue "Varable does not exist: WhoID"
What do I need to do specifically to fix this?
Here is trigger:
trigger LeadResponseTrigger on Task (before insert, before update) {
Set<Id> leadsToCheck = new Set<Id>();
for(Task t : Trigger.new) {
if(t.WhoId != null && String.valueOf(t.WhoId).startsWith('00Q') && t.Status != 'Completed' && t.ActivityDate <= Date.Today()) {
leadsToCheck.add(t.WhoId);
}
List<Lead> leadsToUpdate = [Select Id, CreatedDate
From Lead
where ID in :leadsToCheck and First_Activity_Date__c = null AND CreatedDate > 2010-05-31T12:00:00Z ];
for(Lead l : leadsToUpdate) {
l.First_Activity_Date__c = System.now();
}
update leadsToUpdate;
}
}
What do I need to do specifically to fix this?
Here is trigger:
trigger LeadResponseTrigger on Task (before insert, before update) {
Set<Id> leadsToCheck = new Set<Id>();
for(Task t : Trigger.new) {
if(t.WhoId != null && String.valueOf(t.WhoId).startsWith('00Q') && t.Status != 'Completed' && t.ActivityDate <= Date.Today()) {
leadsToCheck.add(t.WhoId);
}
List<Lead> leadsToUpdate = [Select Id, CreatedDate
From Lead
where ID in :leadsToCheck and First_Activity_Date__c = null AND CreatedDate > 2010-05-31T12:00:00Z ];
for(Lead l : leadsToUpdate) {
l.First_Activity_Date__c = System.now();
}
update leadsToUpdate;
}
}
I found one } issue