+ Start a Discussion
tcash21tcash21 

Need a field on Account Page for custom days since last activity

I've had this problem now for months and finally am resorting to custom coding.

 

All I need to be able to do is figure out how many days it has been since a lead or account has been contacted.

We have a caveat though in that we need to filter out marketing activities so there's a filter that looks like "Assigned != 'Marketing'" at the Tasks/Events level.

 

How difficult would it be to write a trigger in Apex to fill in the most recent Completed Task/Event not assigned to "Marketing" date on an account or lead record?

Is this even possible? And would it be on or before an update/insert? 

 

I'm extremely new to apex coding, but am hoping someone else has had a similar problem and may even have a bit of code to share.

 

Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
Damien_Damien_

It wouldn't be too difficult to do.  You would create a after insert/update trigger on a Task.  You can put something like 'Trigger methods' into the search at developer.force.com to learn how to create triggers.