CS - Non Scalar Error Message

Can anyone explain to me why this doesnt work …

record.set(cs.ref(“fld_xxxxxx”), value);

I keep getting …

Non scalar value passed to record.set() (/main.js, line 50, Event Action: XXXXX) (Script: Gearman 3)

This seems entirely at odds with the documentation ?

For reference, I’m simply setting an integer value into an integer defined property. I have confirmed the reference is all good and value is not undefined.

Thanks

The record is not null either as I am doing some processing with other fields no problem.

OK I have figured it out … for reasons that are not exactly clear …

.valueOf()

fixes the issue :man_shrugging:

so …

record.set(cs.ref(“fld_xxxxxx”), value.valueOf());