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

Error: Invalid conversion from runtime type Decimal to String #442

Closed alxman2021 closed 1 year ago

alxman2021 commented 1 year ago

Hi, I recently updated from version 1.5.49 to version 1.5.65 in order to resolve a couple known issues I was having with the .49 version. Those issues have been resolved, but now I've been seeing this error pop up quite a lot. I haven't had a chance to debug yet and we don't have logging set up, but do you have any idea what might be causing this?

Failed to process Queueable job for class RollupAsyncProcessor for job ID 7078c00009JQ2Ku.

caused by: System.TypeException: Invalid conversion from runtime type Decimal to String

Class.RollupCalculator.StringRollupCalculator.setDefaultValues: line 874, column 1 Class.RollupCalculator.PicklistRollupCalculator.setDefaultValues: line 1073, column 1 Class.RollupAsyncProcessor.getCalculator: line 1306, column 1 Class.RollupAsyncProcessor.getUpdatedLookupItemsByRollup: line 1213, column 1 Class.RollupAsyncProcessor.process: line 672, column 1 Class.RollupAsyncProcessor.performWork: line 345, column 1 Class.RollupAsyncProcessor.QueueableProcessor.execute: line 434, column 1

jamessimone commented 1 year ago

If you enable the "Is Rollup Logging Enabled" checkbox on the org default Rollup Control CMDT record, you should be able to get a detailed log generated by keeping your Salesforce developer console opened while performing the action that generates that error.

Are you using the CMDT-driven flow action? I have made a few changes there over the past few releases (which I can easily revert if they're proving problematic), but that error might also indicate that the CMDT you are using has been set up incorrectly (which prior versions may not have been surfacing correctly). In particular, based on that stacktrace, I'm wondering if you have a default number value set for a text-based rollup.

alxman2021 commented 1 year ago

Thanks for your quick response. I'm using just CMDT driven rollups, not being triggered from flows. I thought I had checked for default values on text-based rollups, but I did accidentally have a CONCAT rollup with a default value of 0. I figured it was something simple I was missing...

I'll review all the custom metadata setup for my other rollups and then open a ticket with more detail if I still have an issue.

jamessimone commented 1 year ago

No problem, glad I could help!