Disallow changing CustomField type after creation #7472

Closed
opened 2025-12-29 20:23:48 +01:00 by adam · 3 comments
Owner

Originally created by @kkthxbye-code on GitHub (Jan 8, 2023).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.4.2

Feature type

Change to existing functionality

Proposed functionality

Disallow changing CustomField type after creation.

Use case

Currently we allow changing the type after creation, but if there's already custom field data saved on an object, in most cases it will cause exceptions in the UI and API when the custom field data is deserialized. Currently there is no logic to handle changing the type. Even if we created logic for converting between all types, it would be a very slow process and error prone as most types are not compatible (float -> int, int -> date etc.).

Database changes

None

External dependencies

None

Originally created by @kkthxbye-code on GitHub (Jan 8, 2023). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.4.2 ### Feature type Change to existing functionality ### Proposed functionality Disallow changing CustomField type after creation. ### Use case Currently we allow changing the type after creation, but if there's already custom field data saved on an object, in most cases it will cause exceptions in the UI and API when the custom field data is deserialized. Currently there is no logic to handle changing the type. Even if we created logic for converting between all types, it would be a very slow process and error prone as most types are not compatible (float -> int, int -> date etc.). ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 20:23:48 +01:00
adam closed this issue 2025-12-29 20:23:48 +01:00
Author
Owner

@PieterL75 commented on GitHub (Jan 9, 2023):

Even renaming a custom field can cause problems. It sometimes times out before all objects have been updated....

@PieterL75 commented on GitHub (Jan 9, 2023): Even renaming a custom field can cause problems. It sometimes times out before all objects have been updated....
Author
Owner

@jeremystretch commented on GitHub (Jan 12, 2023):

Does this need a milestone? Seems reasonable to implement in v3.4.x IMO.

@jeremystretch commented on GitHub (Jan 12, 2023): Does this need a milestone? Seems reasonable to implement in v3.4.x IMO.
Author
Owner

@kkthxbye-code commented on GitHub (Jan 12, 2023):

No, the PR should be good to merge into develop if the approach for limiting field in the API is good enough.

@kkthxbye-code commented on GitHub (Jan 12, 2023): No, the PR should be good to merge into develop if the approach for limiting field in the API is good enough.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7472