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
212 stars 30 forks source link

odd behavior using parent and empty collections #619

Open sweinrarw opened 2 weeks ago

sweinrarw commented 2 weeks ago

seems like this is happening in cmdt and flow based rollups noticed it on 1.6.32 and see the same thing on 1.6.33 one of my production orgs is on 1.6.29 and does not experience this. Note this is rolling up tasks so the cmdt uses the newer text fields to define the child object/field

in the flow based recalc I have the context is set to REFRESH parent record id is included and no "records to rollup" passed

There are two rollup nodes in the flow. one to count "open" records with a filter and one to count all with no filter. I can see the RollupFullBatchRecalculator job run. once its finished there is no actual change to the parent record(last modified stays at the last time it was edited) and the calc field does not change Ive tried using deferred and processing them both together with the same result also tried only running one of them at a time and saw the same thing

jamessimone commented 2 weeks ago

I'm not sure that I ever intended to support not passing records to rollup in flow - my guess is that #610 accidentally "fixed" this by including some default values that weren't previously being passed by the CMDT-based action to the core rollup engine by taking advantage of this release update. That being said, there's little obvious value in those changes so I'm open to removing them if it helps alleviate this issue for you. I will take a look at this next week.

sweinrarw commented 2 weeks ago

Ahh gotcha, I may have misunderstood you on #568 earlier this year. The way I understood it was if the parent id is included in the invocable action for a refresh, the records to rollup should be left blank. I tried using the cmdt based action while passing the records in and got heap size too large error (its a 10k+ list of records), also tried the cmdt flow action with parent id set and no records passed but it doesn't kick off the batch job or update anything. This is mainly used by one of my data analysts on a per record(parent) basis when he has to do manual imports (where the child records dont trigger the normal rollup). I have him do it through a flow so we can stamp a "last full recalc date" on the parent record to prevent it from being re-run multiple times. I'm open to suggestions if there is a better way to go about it. I had also tried the record-based LWC you have to recalculate but it doesn't look like its working either

jamessimone commented 2 weeks ago

Ah no, I don't think you're misremembering - it's me that had forgotten that crucial detail. Thanks for refreshing my memory. Based on it working before 1.6.30 though, I still suspect this to be an unintentional side effect of those new default value additions for Flow. Let me take a look and get back to you!