Allow filtering of ObjectVar and MultiObjectVar input selections for scripts #10444

Closed
opened 2025-12-29 21:31:32 +01:00 by adam · 2 comments
Owner

Originally created by @atownson on GitHub (Nov 6, 2024).

Originally assigned to: @atownson on GitHub.

NetBox version

v4.1.6

Feature type

New functionality

Triage priority

N/A

Proposed functionality

Proposing to extend the functionality of the object selection inputs (ObjectVar and MultiObjectVar) in scripts to be able to filter the selection in the same fashion that's available in the create/edit forms.
image
I might suggest adding the optional parameters selector (boolean with a default of False) and query_params (dictionary) to both ObjectVar and MultiObjectVar classes so that it matches the form parameters. selector=True would show the filter button, and the query_params dictionary to be used to apply the initial filtering.

Use case

Our NetBox instance relies on a few scripts to assist in creating items. Currently we use separate inputs to control filtering (similar to the old behavior of NetBox). Adding the optional filtering would improve the user experience in the same way filtering improved the user experience when using the create/edit forms.

Database changes

None

External dependencies

None

Originally created by @atownson on GitHub (Nov 6, 2024). Originally assigned to: @atownson on GitHub. ### NetBox version v4.1.6 ### Feature type New functionality ### Triage priority N/A ### Proposed functionality Proposing to extend the functionality of the object selection inputs (ObjectVar and MultiObjectVar) in scripts to be able to filter the selection in the same fashion that's available in the create/edit forms. ![image](https://github.com/user-attachments/assets/ba316604-ab96-47c3-b1b0-3502cd2635e5) I might suggest adding the optional parameters `selector` (boolean with a default of False) and `query_params` (dictionary) to both ObjectVar and MultiObjectVar classes so that it matches the form parameters. `selector=True` would show the filter button, and the `query_params` dictionary to be used to apply the initial filtering. ### Use case Our NetBox instance relies on a few scripts to assist in creating items. Currently we use separate inputs to control filtering (similar to the old behavior of NetBox). Adding the optional filtering would improve the user experience in the same way filtering improved the user experience when using the create/edit forms. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:31:32 +01:00
adam closed this issue 2025-12-29 21:31:32 +01:00
Author
Owner

@atownson commented on GitHub (Feb 6, 2025):

I can work on this.

@atownson commented on GitHub (Feb 6, 2025): I can work on this.
Author
Owner

@atownson commented on GitHub (Feb 24, 2025):

Could this be assigned to me, please?

@atownson commented on GitHub (Feb 24, 2025): Could this be assigned to me, please?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10444