I'm trying to add a new boolean field to a device config record. I'd like this field to have a default value of true for existing devices. When creating a new device, I'm not passing the device config record as a parameter, I'm passing an interface, which I've made my record implement, so I'm grabbing the value using a method like
boolean isEnabled() {
return category.newfield}
If I'm creating a new device with this field, the new record gets created with newfield, there's no problem. Surprisingly, this returns a false for existing records, which makes a kind of sense, newfield doesn't exist in that record. Is there a way for me to detect whether newfield exists on an existing record without diving into the resource folder? For example, if I wanted to add a new column in a PersistentRecord in 8.1, I think I just needed to define the field with a default and that was it.