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
AQAQ 

Summary Field Execution Timing

As I understand it, summary fields generally act in a lazy fashion, that is, they update when time is available on the processor.  However, I am wondering if there is any way to force a summary field to execute. 

 

As an example, I have master object A with child object B.  There is a numeric field on child object B which is totalled in a summary field on object A.  I would like to use the value of the summary field in object A from inside the trigger for object B.  In other words, I want to take some action on object A based on summary field totals in object A each time an object B is modified or added.

 

This obviously requires that the summary field be executed prior to evaluation in the trigger.  Does Apex realize this and force the summary to be calculated at that moment before execution of the code evaluating the summary field or does Apex simply use whatever value is there at the time of execution?

 

That's for lending your experience on this issue. 

 

JR