jamessimone / apex-rollup

Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.
MIT License
210 stars 30 forks source link

Grandparent rollup not triggering when intermediate (parent) object is deleted #530

Closed baobao917 closed 9 months ago

baobao917 commented 10 months ago

This is an offshoot of #518 .

In a grandparent rollup, when deleting the intermediate (parent) object, the grandparent rollup is not triggered to recalculate.

Pls see video - https://www.loom.com/share/406c617a4e9044da8d3e97b26dcf3eee?sid=7ea55bff-8786-4e3a-bb3d-3209dc5ec0d7

jamessimone commented 10 months ago

Yup, this is a great call out. I'm working on the fix for #518 at the moment - once that's fixed, it will be easy to fix this one.

baobao917 commented 9 months ago

@jamessimone I tested this fix against v1.6.2 and this issue is now fixed (when deleting the intermediate object, the grandparent rollup is triggered to recalculate). I did notice two other issues and wasn't sure if I should break them out into new separate issues or re-open this one:

  1. When the roll-up calculation is performed AND rollup is configured to default to zero on a full recalculation, it is leaving the rollup field as blank instead of populating with zero (if there are no child records).
  2. When restoring the deleted intermediate record, the rollup isn't triggering a recalculation.

I recorded a video https://www.loom.com/share/29b0706976a84fe29fbc993acfe2966b?sid=fe64b967-5781-4e53-bff1-0f5cb1e22c24

jamessimone commented 9 months ago
  1. Ah yeah, that's a good callout. That will be an easy fix
  2. Remind me, you switched over to using Apex when calling Apex Rollup, right? Undelete is only supported there. Restoring records comes up so infrequently I totally forgot about it for intermediate parents in a grandparent rollup. I can get that fixed
baobao917 commented 9 months ago

Ah...I forgot that undelete is only supported in apex trigger and not flow trigger. That is why. In this particular case the intermediate object (work order) is a flow trigger.

On Sun, Nov 12, 2023, 9:24 PM James Simone @.***> wrote:

  1. Ah yeah, that's a good callout. That will be an easy fix
  2. Remind me, you switched over to using Apex when calling Apex Rollup, right? Undelete is only supported there. Restoring records comes up so infrequently I totally forgot about it for intermediate parents in a grandparent rollup. I can get that fixed

— Reply to this email directly, view it on GitHub https://github.com/jamessimone/apex-rollup/issues/530#issuecomment-1807380600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7A4O2BNWKJDUCBSECM75TYEGAFBAVCNFSM6AAAAAA6UMIUD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGM4DANRQGA . You are receiving this because you authored the thread.Message ID: @.***>

baobao917 commented 9 months ago

@jamessimone I tested this follow-up issue (bullet below) against v1.6.3 and it's now working as expected. Thanks!

jamessimone commented 9 months ago

Ah yes - I need to create another issue off of this one for the undeletion part of this