API4: FALSE incorrectly treated as NULL
Overview
API4 treats a FALSE
as a NULL
during update actions. This breaks the bulk entity update functionality of Search Kit.
Reproduction steps
- Create an Activity custom field of type "Yes/No".
- In Search Kit, search for activities.
- Select one or more activities and use the Update Activities action to set the custom field's value to
Yes
. - Observe that this works correctly.
- Select the same activities and use the Update Activities action to set the custom field's value to
No
.
Current behaviour
The activities whose custom field was supposed to be set to No
are nulled out.
Expected behaviour
The custom field's value should be set to No
.
Comments
This is replicable in API4, but not in the Explorer. The issue only occurs when the addValue()
is passed FALSE
, but not when addValue()
is passed 0
. Since API Explorer always uses a 0
when you select No
, the bug doesn't occur. Nor does it occur with the cv (short)
syntax, presumably because cv
is doing some conversion of the value(s). However, you can replicate this with the cv (pipe)
code - e.g.:
This works correctly:
echo '{"values"{"Availability.Are_you_available_in_the_morning_":0},"where":[["id","IN",[689,688]]]}' | cv api4 Activity.update --in=json
This exhibits the bug:
echo '{"values"{"Availability.Are_you_available_in_the_morning_":false},"where":[["id","IN",[689,688]]]}' | cv api4 Activity.update --in=json