apex-rollup icon indicating copy to clipboard operation
apex-rollup copied to clipboard

Rollup Full Recalc sometimes edits parent records even when no rollup fields were changed

Open solo-1234 opened this issue 1 year ago • 6 comments

When running full recalc from the Rollup app, some parent records will be "updated" (aka DML) even though no rollup fields have changed. This can cause issues with triggered automation on those parent records (in my situation, other rollups from that object to another).

It seems to be doing this only for parent records that have related child records, but none that match the criteria in the where clause. Because of this, the parent records' rollup fields are null (which is correct), and rollup tries to update them to null, which is not necessary.

Thanks for your help!

solo-1234 avatar Jul 25 '22 16:07 solo-1234

@solo-1234 thanks for logging this. as per our conversation last week, I have a good idea about how this issue could occur and should be able to quickly implement a fix.

jamessimone avatar Jul 25 '22 19:07 jamessimone

Awesome, thanks for the update!

solo-1234 avatar Jul 25 '22 19:07 solo-1234

@solo-1234 I've made a change that tentatively may address this. Looking forward to your feedback!

jamessimone avatar Jul 29 '22 20:07 jamessimone

Just following up on this to see if you have any updates, thanks!

solo-1234 avatar Aug 04 '22 23:08 solo-1234

@solo-1234 I'll re-open, for now. I will have a reduced scheduled for open source work the next ~week or so. I've been trying to finish up #353 before that and haven't had the chance to dig in again on this one.

jamessimone avatar Aug 04 '22 23:08 jamessimone

Not a problem - I just saw it mentioned in some activity and was wondering what it was. Thanks!

solo-1234 avatar Aug 04 '22 23:08 solo-1234

Closing after talking to solo on Discord - the issue was with parent records still having 0 (which previously was the default value for number-based rollups, but had since been changed to null to align with how aggregate queries work in SOQL)

jamessimone avatar Aug 23 '22 13:08 jamessimone