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
Nathan WylderNathan Wylder 

need to code roll up summary from Case object (date) to Contact object

My org uses cases to keep track of volunteer participation. I want a field on the contact object that will tell me the last case each volunteer is associated with. This seems simple in my mind, but looks like I'll need to code this in Apex or Soql...but I don't know how to do this. How can this be done? Cases are related to Contacts via look-up fields and while they display neatly in the related lists on the contact object, I need this roll up field for reporting and statistics. 

I have the free version of roll up helper but am already maxed out. I need to be able to code this. Thanks in advance.
Alain CabonAlain Cabon
Hi Nathan,

You can avoid an apex class with just one flow activated by a process created with the Lightning Process Builder.

There is a brilliant example of how-to here: http://www.salesforceweek.ly/2015/02/how-to-flow-most-recent-record.html

You have just to change Account with Contact and that should work.

The last problem is to initiate all the existing contact with their most recent cases but it is not very complex with an export of data using an SOQL request from the workbench (+ a simple transformation of data for having only the most recent cases) and an import of the result with the data loader.

Regards

Alain