function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Julie CurryJulie Curry 

How can I add Date of first activity to the lead record?

I have been told that inserting the date of first activity isn't possible without code.  I was wondering if someone here can help with this.  I'm an admin so I don't know code unfortnuately :/

Below is the closest thing I could find to what I think I want/need is below, but it references marketo.  Any help with this would be greatly appreciated! 


LeadResponseTrigger on Task (before insert, before update) {
    if( UserInfo.getUserId() == '<Marketo's User ID>' ) {
        System.debug(LoggingLevel.Info, 'LeadResponseTrigger bypassing for Marketo');
       return;
    }

    Set<Id> leadsToCheck = new Set<Id>();
    for(Task t : Trigger.new) {
        if(t.WhoId != null && String.valueOf(t.WhoId).startsWith('00Q') && t.Status != 'Pending' && t.ActivityDate <= Date.Today()) {
            leadsToCheck.add(t.WhoId);
        }
    }

    List<Lead> leadsToUpdate = [Select Id, CreatedDate 
                                From Lead 
                                where ID in :leadsToCheck and First_touch_time__c = null AND CreatedDate > 2014-12-17T12:00:00Z ];
    for(Lead l : leadsToUpdate) {

        l.First_touch_time__c = System.now();
    }
    update leadsToUpdate;

}
Vivek DVivek D
Try using a process builder and a flow combination.
1. Create a process builder on task. 
2. Add condition that WhoId (Name) starts with 00Q.
3. In action choose launch a flow and create a variable to pass lead id (WhoId)
4. In flow, based on the lead id either check if it has any activty on it uning lookup, or just check the lead last activty date, if there is no output for any of them, means it is the first activity and update the lead with todays date.
Some blogs which shows how to use process builder with flows :-
http://www.arkusinc.com/archive/2015/opportunity-contact-roles-with-process-builder-and-flow
https://developingflow.com/2015/07/11/launch-a-flow-using-lightning-process-builder/


You can aslo find more examples