Leads: List View: Possible to sort by "activity date:

Is it possible to be able to sort the leads by the date they had some activity, as in when the last time they were emailed from their lead detail page?

I added the “Modified date” column in Admin->Studio, but that doesn’t seem to work.

It’s not possible on the standard installation. You have to remember that Leads and the different activities are created and stored on their own module. Relationships are stored separately.

The work around is to create a date field under Leads and utilize workflows/logichooks to update the field every time an activity is linked to this record. For that you need to go to every module that create an activity against the a Lead and add your logic.



1 Like

Just to build on what @AlxGr wrote, if your Workflows detecting the related activities simply change something (anything) in the Leads record, then the default modified_date field should provide you with what you want.

You basically just need a way for modifications in relationships to also count as modifications to the record.

Thanks - I can’t find a way to do that when an email is sent from the leads record or if a new entry in the “History” table is created. Any suggestions on how to do that?

Are you ok with writing logic hooks?

I would try to catch a after_relationship_add event and get the related Lead, and change a field there (any field, just to get the modified_dateto record the event).

I’ve done a bunch of php and coding - never logic hooks though

It’s not to late to start then :slight_smile:

Here is a sample: http://cheleguanaco.blogspot.com/2012/03/sugarcrm-cookbook-adding-related.html