SUM throws a runtime error when the list contains a null, rather than skipping it.
Repro
No org data needed:
expression.Evaluator.run('SUM([1, null, 3])', someId); // runtime error
expression.Evaluator.run('SUM([1, 2, 3])', someId); // => 6
Expected: 4, treating null as absent — or at minimum an error that names the problem.
Actual: a runtime error with an empty message (see the separate issue about error messages).
Why it matters
This is the normal shape of a rollup over records, where an optional currency or number field is
blank on some rows:
Opportunities -> WHERE(IsClosed = false) -> MAP(Amount)
One opportunity with no Amount and the whole total fails. Because the failure is a hard error
rather than a skipped row, a formula that works today starts failing when someone saves a record
with a blank field — and with no message, there is nothing to indicate which field or row caused
it.
Guarding every rollup with -> WHERE(Field != null) works, but it has to be remembered for every
nullable field, and forgetting is silent until the data changes.
AVERAGE and similar aggregates are presumably affected the same way.
Environment
Expression 1.52.0.1, Developer Edition scratch org.
SUMthrows a runtime error when the list contains anull, rather than skipping it.Repro
No org data needed:
Expected:
4, treating null as absent — or at minimum an error that names the problem.Actual: a runtime error with an empty message (see the separate issue about error messages).
Why it matters
This is the normal shape of a rollup over records, where an optional currency or number field is
blank on some rows:
One opportunity with no
Amountand the whole total fails. Because the failure is a hard errorrather than a skipped row, a formula that works today starts failing when someone saves a record
with a blank field — and with no message, there is nothing to indicate which field or row caused
it.
Guarding every rollup with
-> WHERE(Field != null)works, but it has to be remembered for everynullable field, and forgetting is silent until the data changes.
AVERAGEand similar aggregates are presumably affected the same way.Environment
Expression 1.52.0.1, Developer Edition scratch org.