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
Sachin K 13Sachin K 13 

To find out the Last Activity Date of Type = 'F2F' on Account

Dear Friends,

I have a requirement to display Last Activity Date (Due Date) of Type=F2F on the Account, Activity can be either a completed Task or Event. It can be either directly related to an Account or through Opportunities of the respective Account.
Appreciate any pointers to achieve this requirement. If there is a sample code for matching this requirement can someone please post.
 
RKSalesforceRKSalesforce
Hi Sachin,

Unfortunately i don't have matchinf code for this requirement at the moment. As per my understanding you will have to write two triggers on Event and Task Object(After insert, after Update).  Write your logic in associated Helper Class.
Create 2 lists : 1 for Tasks and 1 For Event
Add all the associated Events of Account and Opportunities in the Events List and do Same thing for Tasks. Arrange both the lists in descending order and compair desired  date field of zeroth element of both the lists and then update the Account.

Please let me know if this helped.  

Regards,
Ramakant