Partners

Product Updates

DatoCMS changelog for new features and general improvements
Content Management APIContent Delivery API
Updates to Boolean field handling
January 8th, 2024

In an effort to simplify frontend tasks and prevent confusion over types, we're introducing a change in the way we handle the return value of boolean fields in your records.

Basically, boolean fields will never return null, and only true or false. Where previously the APIs would return null, they will always normalize the value to false.

Who is impacted

Starting today, only newly created DatoCMS projects will follow the new convention.

Existing projects won't be affected in any way, as this new behavior could result in breaking changes. If you wish to apply the update on a existing project, you can do so from your project's settings.

What changes

You'll notice the change in two situations:

When a new boolean field is added to a model/block model

If there are already existing records in the model, and no default value is assigned when creating the field:

  • Previously: The field value would remain null for each existing record.

  • Now: The field value will be false for each existing record.

When a record is created/updated through CMA

If you set the boolean field value to null:

  • Previously: Both CMA and CDA would return null.

  • Now: Both CMA and CDA will return false.

Enable update on existing projects

To activate the new functionality on existing projects, head over to the "Available Updates" section of their environment configuration, as shown in this video:

As with any update, we strongly recommend testing the effects in a sandbox environment before applying the change to your primary environment, as this update cannot be undone.