• Son H
  • NEWBIE
  • 10 Points
  • Member since 2015
  • Salesforce Administrator


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
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;

    }
}
  • June 02, 2016
  • Like
  • 0
How do I auto populate Contact into New Task using a custom button on a custom object?

So far I created a custom button in a custom object with the following syntax. It is properly creating a Task and pulling in the Account information and relating to the custom Object. How do I populate the Contact into the Task Page?

Here is my code:

/00T/e?who_id={!Call__c.AccountId__c}&
what_id={!Call__c.Id}&retURL=%2F{!Call_Report__c.Id}
  • March 25, 2016
  • Like
  • 0
I'm new to Apex and need help with writing a trigger that when there a new user is created or modified that they are added to a chatter group called "All Group" or Group ID. Any help is appreciated.
  • January 07, 2016
  • Like
  • 0