Skip to main content

Governor Limit exception due to Rollup Summary Field Change

 Rollup Summary Field(RSF) gives an easy way to get values from related records when the two objects are related via Master -detail relationship. We can perform different types of calculations with a roll-up summary field such as count, sum, minimum value, or maximum value of a field in the detail records.

I am sharing one of the platform behaviour noticed with Rollup Summary field calculation. When RSF definition is changed with an aggregated Field, Filter and Type, It will trigger Field Recalculation. When the currency conversion rates are changed, The currency fields are recalculated.

As an admin, you have two options on field calculations.

  • "Automatic calculation" option is to let salesforce decide the best time to run field Calculation.
  • "Force a mass recalculation" option is to initiate the field calculation immediately.

Whenever the field definition is changed, Depends on the calculation option selected, A background job with Type 'Summary Field Recalculation' will be started. This job can take a minute to a week depends on the volumes of data you have the organization.

You can monitor the background jobs using the steps here. But to abort the jobs or find out why 

In normal scenario, When a child record is edited where aggregated field value is changing, This invokes a DML operation on parent record where the RSF exists. But when the Sharing calculation job is running, Any DML on Child whether Aggregate field is changing or not, will invoke the DML on Parent records.

The problem here is that when your org is already running close to governor limits such SOQL, CPU time limits, This additional DML will make the transaction hit the governor limits.

This gives one more reason why Admins need to plan the RSF definition changes only during non business hours. 

If the regulation is in progress for the long time, We can either recalculate the field by selecting 'Force a mass recalculation option' in the field definition or abort the job by contacting support.