When I save a DOM Instance after changing a String - Field, will the Bool Field in the same section - instance, get updated to false?
I ask, because bool does not have a null value while string does.
I suspect that when executing the save instance, all fields that are not null get stored. Meaning that the bool field, when I do not set it myself, will get overwritten.
Is my theory correct?
What I do in logic:
- Check if a field value requires an update or not.
- ONLY when it does: execute the AddOrUpdateFieldValue method on the domInstance
- ONLY when changes were done to min. 1 field: execute domHelper.DomInstances.Update(domInstance)
Hi Mieke,
The values of a field in a DOM Instance are wrapped in a FieldValue. When no value is added for a field, it will not contain a value. So for a bool field, in your case, your instance would not have a value for that bool field if you didn't add it.
This also goes for nullable types like string, it's not because you didn't pass a value for that field, that it will be null, it will just not have a value.
Your instance will be saved the way you passed it to the Update method on the DomHelper. Fields that had no values, will still have no values, and will not default to 0 (int), false (bool), or null (string).
There is a graphical representation showing the layout of a DomInstance that maybe explains it better than I am on the DomInstance page in the docs.
OK thank you.
This means something is wrong in the way I’m saving it.