New boolean field doesn't update old records / boolean field defaults to `null` instead of `false` (edited title)

Describe the issue:

I have a model with existing records on it. I just created a new boolean field and set the default value as false.
If I change a record and save it, it returns a boolean. The problem is with the old records that I didn’t edit again that returns null
It seems as if adding a new field with a default value is not updating in cascade all the records that the model has

Hi @gines.ortiz , and welcome to the forums!

Thanks for bringing this to our attention! After some investigation, it looks like the default value DOES cascade across all the records (you can try it with a new text field), but it looks like the default value of a boolean field set to false is null instead of false. Then when you trigger it on and off again, it will save as false.

This may be a bug on our end. I’ll report it to the devs and let you know what they find. Sorry about that!


Just as a workaround in the meantime, on the frontend, can you use strict truthiness to only do something if booleanField === true? You can also use !booleanField to be both null and false. This isn’t a very clean solution, so I’ll still let the devs know, but maybe it could help in the meantime?

Thank you and sorry about this.

We’ve confirmed this as an issue internally, and will be working on it soon! I’ll report back here once we have a fix out.

In the meantime, hopefully the workaround above helps?

2 Likes

Yes, we did something similar just by creating a bool using !!, thanks for the quick response!

1 Like

Hi @gines.ortiz: Just so you know, we’ve officially released a (opt-in) fix for this:

By default, this will only affect newly-created projects after today. But if you want to apply it to an existing project (after testing it in a sandbox first), you can opt-in to the fix by going to your environment config → Available updates:

Your existing workaround using !!boolean will continue to work, too. Just letting you know!