Is there a way to configure a trigger such that when a new activity (call, meeting, task, note, etc.) is added in relation to another record (i.e. an opportunity record) the Date Modified on the related/parent (opportunity record) changes?

I'd like to find a way to change the Date Modified on an (opportunity/organization/client contact, etc.) record when an associated activity (specifically: call, note, meeting, task) is added and tied back to the (opportunity/organization/client contact).  Is this feasible? 

This would help with reporting - i.e. tracking stagnant opportunities.  In this scenario, perhaps nothing on the opportunity record itself changes, but a new call, or meeting has been logged so progress is being made behind the scenes.  If I could change the date modified on the actual opportunity record (only if the note, call, etc. has been tied to an opportunity or otherwise - I do realize they can be created independently), it'd be helpful!  

  • Jupp, quite easy.

    Add a field to each module you want to track like this:

    Most important is the default value because it is added on create.

    On my try I added the same field on meetings and calls:

    Now go to opps and add:

    With this formula (add more fields from additional modules as you wish)

    add(rollupSum($calls,"count_c"),rollupSum($meetings,"count_c"))

    Formula causes that every change on a related activity will change the date modified of the opp... but I assume this is what you want because you presumably need to track changens on anything that happens to the opp.

    Edit for other people looking for a solution: This formular works if you want to update the modified date on create of an activity only. For all updates see below

    Worked fine on my test. (SugarCRM 8.3 ENT)

    Bests

    Björn Canales Pfisterer

    Technical Support Manager

    provalida GmbH

  • Thanks for the response.  This works, but only when a new activity is CREATED.  If I go back in and update my note, task, meeting, call, etc. it does not update the date modified.  I need it to update the date modified both when an activity is created an also when an activity record is updated. 

  • Hi Emily,

    I had a similar desire - I wanted to count the calls (and emails) sent to a Contact and to an Account along with the Date of the last Call or email.

    In those modules (Accounts and Contacts) I added two fields for each - the number and the date of the last one:

    Number of Calls

    Last Call

    Number of emails

    Last email

    For the "Number of" fields I use the formula: count($calls)

    For the "Last" fields I use the formula: maxRelatedDate($calls,"date_entered")

    Also, opening and saving (or at the next change) both fields update.

    It works for me!

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

  • Hey Emily Adams,

    ok, not a poblem. The standard value has been set on create and editing the activity has not trigger the calculation.

    We can fix this easily by adding a calculated value to the "count_c" field in each activity module we want to be respected:

    add($count_c,1)

    this will add +1 on every time you save the activty record and triggers the opp to higher the count.

    Worked fine again on my own tests on  Sugar 8.3 ENT

    Bud Hartley, give it a try, this may reduce the number of fields you need. I like your way of solving it and will give it a try because I bet it can be helpfull in similiar challenges!

    ps.: if it works fine for you, please mark this thread as solved for helping others to find a solution.

    Cheers

    Björn Canales Pfisterer

    Technical Support Manager

    provalida GmbH

  • Hi Bud,

    Can you explain how emails are handled?  I don't see email fields in Studio.  Thanks in advance.

  • Hi Ron,

    I'm sorry, I posted the formula for Calls, and I should have also added the formula for emails.  Like the Calls, it's the email sub-panel that's referenced:

    The the Last email the formula is: maxRelatedDate($emails,"date_entered")

    The count of emails appears in the sub-panel heading, but if you want a field in the record somewhere the formula is: count($archived_emails)

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)