netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.84k stars 2.54k forks source link

Removal of an option in a CustomFieldChoice does not update objects with the choiceset and the option selected #17558

Open cruse1977 opened 4 days ago

cruse1977 commented 4 days ago

Deployment Type

NetBox Cloud

NetBox Version

v4.1.1

Python Version

3.12

Steps to Reproduce

image image image

Expected Behavior

The selected option on the choiceset attached to device Z should be null/none, due to the option removal

Observed Behavior

Option B remains until the object is edited or saved, despite no longer existing.

image

Note - Due to the options inherent within ChoiceSets (eg: Non Null, default etc) but I'm trying to ascertain if this is a bug (ie: NetBox should warn/error on Objects with this choice selected) or expected behaviour - hence requesting feedback

arthanson commented 18 hours ago

This should throw a validation error if you try to delete a choice and there are items assigned to that choice.

goteamkor commented 18 hours ago

just my 0.02 cents, I prefer the exiting method. You should be able to remove options from a choice set, and objects currently referencing that option should maintain their selection until the next time you attempt to edit that object.

Removing a choice set doesn't make the choices selection on each object automatically invalid. It just means it's no longer available as a selection.