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
Mike KampffMike Kampff 

Last Activity Date, that doesn't have specific text in activity subject

I need to add a custom date to a lead that calculates the last time a sales rep personally contacted the lead.

Problem is, my marketing automation system (Autopilot) is adding a lot of activity records so I Last Activity Date does not work.

Fortunately, Autopilot prefixes all activity subjects with "[Autopilot]". 

Is there a way to create a custom field that calculates the date of the most recent activity, where the subject does not contain "[Autopilot]"?

Thanks in advance
Praveen KHariPraveen KHari
Hi Mike,

Even I had similar requirement. Where I need to calculate last activity date on account object based on a custom date field (“Completed Date” custom field).
I created a trigger and a batch job to handle this.
Batch Job:
Takes all activities those are modified for accounts and recalculate the last activity date based on custom field and update the account’s custom field with latest last activity date. There can be delete operation also. So you should query for all rows
Whenever new Task or Events modified/ deleted. I was doing the same logic I was running in the trigger.
Sometimes there will be issues on the data volume that the reason I kept both in the system
-Praveen K Hari