netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Add to filter ability to select multiply values from custom field with 'Type = Selection'

Open mtroshyn opened this issue 1 month ago • 2 comments

NetBox version

v4.2.2

Feature type

New functionality

Proposed functionality

First, I will show the problem on screenshot. We have custom field 'Client' with type = Selection. The selection stores several thousands of choises. We use this custom field in rack object. Image

When we try to use rack filter and select several values from custom field 'Client', we can't do it. Netbox allows to choose only one choice. Image

My proposal is to implement ability to choose several values in filter for custom fields with type = selection.

Use case

This feature improve user experience working with netbox. Also it saves time to get information from netbox based on some criteria.

Database changes

No response

External dependencies

No response

mtroshyn avatar Nov 28 '25 11:11 mtroshyn

I had a quick look at the CustomField.to_form_field() helper. As it stands, the TYPE_SELECT custom field always maps to a single-value choice field & widget, even when it’s used to build filter forms. That’s why the rack filter UI only allows picking one value from a selection-type custom field today.

To address this, I’d like to extend to_form_field() with a for_filter_form flag, similar to the existing for_csv_import argument. When for_filter_form=True and type == TYPE_SELECT, we could return a multiple-choice field (e.g. using APISelectMultiple), while keeping the existing behavior unchanged for create/edit/bulk-edit forms.

If this approach sounds acceptable, I’d be happy to pick this up and open a PR.

pheus avatar Dec 10 '25 21:12 pheus

Sounds workable, @pheus. Assigning now.

jnovinger avatar Dec 15 '25 20:12 jnovinger