Custom field multiple selection #4351

Closed
opened 2025-12-29 18:35:06 +01:00 by adam · 5 comments
Owner

Originally created by @TomGrozev on GitHub (Dec 13, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.8.6
  • NetBox version: 2.10

Proposed Functionality

The ability to be able to select multiple values in custom fields of type "Selection". This is similar to how tags work but the ability to do it for custom selection fields. A new option to allow multiple options to be selected for custom selection fields would be added and using the Django multiple selection form, this can be added.

Use Case

We use ansible to deploy configurations and NetBox as the source of truth. We need to be able to select multiple applications for a virtual machine and then ansible can use that to deploy the application. In order to do this and install multiple applications, we need to be able to select multiple values from a custom field of type "Selection".

Database Changes

A new multiple selection field would be added to the custom field model. Since the changes in version 2.10
store custom field data as JSON, storing a list of values is simple.

External Dependencies

None

Originally created by @TomGrozev on GitHub (Dec 13, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.8.6 * NetBox version: 2.10 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality The ability to be able to select multiple values in custom fields of type "Selection". This is similar to how tags work but the ability to do it for custom selection fields. A new option to allow multiple options to be selected for custom selection fields would be added and using the Django multiple selection form, this can be added. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case We use ansible to deploy configurations and NetBox as the source of truth. We need to be able to select multiple applications for a virtual machine and then ansible can use that to deploy the application. In order to do this and install multiple applications, we need to be able to select multiple values from a custom field of type "Selection". <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes A new multiple selection field would be added to the custom field model. Since the changes in version 2.10 store custom field data as JSON, storing a list of values is simple. <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 18:35:06 +01:00
adam closed this issue 2025-12-29 18:35:06 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 14, 2020):

With the move to JSON-based custom field data in v2.10, this is now a possibility.

@jeremystretch commented on GitHub (Dec 14, 2020): With the move to JSON-based custom field data in v2.10, this is now a possibility.
Author
Owner

@hyudra commented on GitHub (Dec 21, 2020):

Is it possible to add custom field with JSON / List type? Sometimes our data do not have fixed length data (such as VM with multiple disks).

@hyudra commented on GitHub (Dec 21, 2020): Is it possible to add custom field with JSON / List type? Sometimes our data do not have fixed length data (such as VM with multiple disks).
Author
Owner

@TomGrozev commented on GitHub (Dec 24, 2020):

@hyudra In order for multiple fields to be selected, the natural solution is for the items to be stored as a list in JSON.

@TomGrozev commented on GitHub (Dec 24, 2020): @hyudra In order for multiple fields to be selected, the natural solution is for the items to be stored as a list in JSON.
Author
Owner

@schmitmd commented on GitHub (Feb 15, 2021):

I've got the same use case as TomGrozev. Using Netbox as a dynamic Ansible inventory via the Netbox Ansible collection. It looks like #5440 / #5459 were closed as rejected though. Is someone going to re-implement this functionality differently for the 2.11 milestone or are those PRs actually valid & intended to be pulled in, or...?

@schmitmd commented on GitHub (Feb 15, 2021): I've got the same use case as TomGrozev. Using Netbox as a dynamic Ansible inventory via the [Netbox Ansible collection](https://docs.ansible.com/ansible/latest/collections/netbox/netbox/index.html). It looks like #5440 / #5459 were closed as rejected though. Is someone going to re-implement this functionality differently for the 2.11 milestone or are those PRs actually valid & intended to be pulled in, or...?
Author
Owner

@fabi125 commented on GitHub (Feb 18, 2021):

Is it possible to add custom field with JSON / List type? Sometimes our data do not have fixed length data (such as VM with multiple disks).

Having a custom field that can store multiple values (not necessarily from a selection) would be great. Can this FR be expanded to include that or should I open a separate issue?

@fabi125 commented on GitHub (Feb 18, 2021): > Is it possible to add custom field with JSON / List type? Sometimes our data do not have fixed length data (such as VM with multiple disks). Having a custom field that can store multiple values (not necessarily from a selection) would be great. Can this FR be expanded to include that or should I open a separate issue?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4351