+ Start a Discussion

Activity Last Modified Date on Opportunity

I need a field in the opportunity object that reflects the number of days since any activity linked to the opportunity was updated (Last Modified Date on Activity record).  This can either be a task or an event which is open or completed.
Since this field is not accessible as a rollup on the opportunity, I'm guessing I have to create a trigger to do this.  Any ideas?
The field LastActivityDate on Opportunity will tell you the date the last activity was done.

Correct, but that's based on the Date (Due Date) on the Activity not when that Activity was modified.  I'm trying to isolate any Opportunities that have not been updated with new Actiivities or had their Activities modified since 6/1/2009.


It would also help to be able to report on any Opportunities that have no Activities.




I am in the process of trying to resolve this exact reporting issue, and wanted to know if you ever came up with a way of reporting on this information?


It seems like a trigger on activities/events to update a field on the opportunity page is the only way to achieve this?


Yes, I ended up writing a trigger on Activity that will update a Last Activity Date (date type) field on Opportunity whenever the Last Modified Date on the Activity changes.  Not the best or easiest way to do it, but it works. 


Wish there was an easy way to roll this up to the Opportunity though.  The trigger I wrote causes all kinds of problems on opportunities when it tries to update the field and the validation rules fail.