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
Tyler Ball 1Tyler Ball 1 

Display last activity by owner on accounts

We're trying to create an account field which displays the last activity date for activities created by the account owner. Has anyone found a way to do this?

Thank you,
Tyler
PratikPratik (Salesforce Developers) 
Hi Tyler,

I tried creating a formula field and put formula as LastActivityDate. 
You can check the below link as well.

https://help.salesforce.com/apex/HTViewSolution?urlname=What-is-the-difference-between-Last-Activity-and-Last-Modified-1327108315155&language=en_US

Thanks,
Pratik
Tyler Ball 1Tyler Ball 1
Pratik, the LastActivityDate field displays activities for all users. I'd like to display the last activity date for activities created by the account owner.
Geoffrey J FlynnGeoffrey J Flynn
Hi Tyler,

Task is one of those funny ones because of the WhoID and WhatID fields replacing what would otherwise be standard lookup fields.  
As a result of this you would have to track these with a trigger I think.
It would end up being something like:
If new task creator = WhatId owner , update custom field on account with today's date

Salesforce does have custom lookup fields on Activities in Beta testing right now which would allow you to update this with normal workflow rules I think, assuming they provide all functionality with the release.
David BermanDavid Berman
I would download the Rollup Helper package and build a rollup to grab the most recent activity by the account owner and stamp that on the account record.  This is a pretty standard rollup and the Rollup Helper site probably has that covered in one of its use cases.  With Rollup Helper you get 3 freebies (rollups) before you have to purchase it.  

Alternatively you could build a Lightning Process (assuming you have Enterprise Edition) that fires when an activity is updated, to find the parent account, then search for all the account owner's activities for that account, sort the list in a descending manner, and grab the first record's date, and stamp it on the account.