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
TenaTena 

Custom Rollup Summary Vs. Hidden VF page

I have a custom object that links to a standard object via a junction object.  On my custom object I have a field that needs to be a summary of values on the standard object.  I see 2 solutions:
1)  Create a trigger on the standard object so that when the standard object counts are updated it processes and updates my custom object
    -  Pro:  my number in my custom object will always reflect correctly if using report
    -  Con: seems like a lot of system usage.
2)  Create a Visualforce page and hide it on the custom object page.  When the user views the item then the number is updated
    -  Pro:  Won't use as much system resources
    -  Con:  Won't have update numbers on objects if they do reports.  The number is only updated when someone opens it from the front end.

I would like to know what others experiences have been regarding this and what they found best.
Ashish_SFDCAshish_SFDC
Hi Tena, 


Writing a trigger is the best option, there is not much System usage used just a simple Trigger will do. 

There is a sample trigger and also the test class inplace in the blog below, 

http://www.anthonyvictorio.com/salesforce/roll-up-summary-trigger/


Regards,
Ashish