SFDO-Community/declarative-lookup-rollup-summaries

DLRS fails rollup on Checkbox when no records found

DanDonin opened this issue ยท 8 comments

When DLRS is rolling up a checkbox if no records are found to rollup then it will spit out an error of

INVALID_TYPE_ON_FIELD_IN_RECORD.

I think it is because when DLRS finds no records it goes to NULL the value on the rollup on the Parent. Problem is Checkboxes only take TRUE/FALSE not Null so it triggers this issue. Possible workaround is a checkbox on the DLRS record of "Is the rollup a checkbox?" and if this is checked then when no records are found DLRS sends a FALSE statement in-place of a NULL statement.

Thanks @DanDonin makes sense, and should be an easy fix. Once again, great having your support, you rock! ๐Ÿ‘

@afawcett do you have a branch of this bugfix started?

@DanDonin I found a workaround for this! Create yourself a formula field that is checkbox output. And then just use this as your formula value: "IF(your_original_checkbox_field__c, true, false)" and then use that as your field to aggregate. And then add your_original_checkbox_field__c as a Relationship Criteria Field.

And it works for me!

I lied, sort of. :) My child record that used to meet the criteria no longer meets the criteria, DLRS still tries to write null regardless of what my Field to Aggregate evaluates to. However, if the records continue to meet the criteria and the checkbox changes from true to false, it will work as expected.

@afawcett

My dev machine is all discombobulated. Here is a gist with a headstart to fix this, I think at least. :)

https://gist.github.com/wes1278/e9d992cb289f5f2d31b451f5cf820b90

#discombobulated love it, thanks for sharing!

Fixed in v2.6.

Yay! Thanks for the release of this one @afawcett I have something in prod that is having this error now.

Thanks to @wes1278 for the patch also. ๐Ÿ‘