Skip to content

Correctly record Boolean as FALSE when using API3 create

JonGold requested to merge JonGold/form-processor:working-false-boolean into master

Currently, you can not record a FALSE value from a Boolean to the database.

Steps to Replicate

  • Create a "Yes/No" custom field on contacts.
  • Create a new form processor.
  • Create two inputs, contact_id (Integer) and yesno (Boolean).
  • Create an action "Update Contact Custom Data" which updates the new custom field on the specified with the value of yesno.
  • Save your form processor and test the form processor.

Expected Result

Boolean TRUE sets the custom field to "Yes". Boolean FALSE sets the custom field to "No".

Actual Result

Boolean TRUE sets the custom field to "Yes". Boolean FALSE results in no change to the field.

This is a quirk in API3, but it's not going away, so I fixed it by allowing the Boolean input type to return TRUE/FALSE or 1/0. We default to TRUE/FALSE for backward compatibility.

Merge request reports