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
tejateja 

Trigger to pull the open activity from Leads.

I want to implement a trigger to scan the activities and check whoid to see if it is a lead. if not ignore it
and if it is alead i want to pull the next activity date of every lead and display it lead detail page by creating
a field something like Next open Activity Date or Earliest Activity Date.

 

Any help will be highly appreciated.
Thank you.

Bhawani SharmaBhawani Sharma
you can create a after insert, after update trigger on event and check if whoid starts with 00Q(Lead). If yes, then create the Lead instance using
lead lead = new Lead(Id = event.WhoId);
and set your Next activity date like
lead.NextActivityDate__c = event.ActivityDate.
update lead.