Make an easy way to pre-fill custom script variables #9722

Closed
opened 2025-12-29 21:21:37 +01:00 by adam · 3 comments
Owner

Originally created by @llamafilm on GitHub (May 22, 2024).

NetBox version

v3.7.3

Feature type

Change to existing functionality

Proposed functionality

When selecting dropdown variables in a custom script, update the URL immediately with the currently selected options, so it can be easily bookmarked. This answer describes a simple way to do this: https://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page

Use case

I have an "add device" script with lots of variables. When adding several devices to the same site/rack, I create a browser bookmark with those query params, so I can keep coming back to the script with those fields pre-filled. It would be much easier if those query params were added to the URL immediately after entering the dropdowns. As it is now, I have to open a new tab to find the ID for each of those objects, and type a long query string by hand.

https://github.com/netbox-community/netbox/assets/3991046/8c46f4eb-6e66-44f3-afa3-b6ff9ff192dc

Database changes

none

External dependencies

none

Originally created by @llamafilm on GitHub (May 22, 2024). ### NetBox version v3.7.3 ### Feature type Change to existing functionality ### Proposed functionality When selecting dropdown variables in a custom script, update the URL immediately with the currently selected options, so it can be easily bookmarked. This answer describes a simple way to do this: https://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page ### Use case I have an "add device" script with lots of variables. When adding several devices to the same site/rack, I create a browser bookmark with those query params, so I can keep coming back to the script with those fields pre-filled. It would be much easier if those query params were added to the URL immediately after entering the dropdowns. As it is now, I have to open a new tab to find the ID for each of those objects, and type a long query string by hand. https://github.com/netbox-community/netbox/assets/3991046/8c46f4eb-6e66-44f3-afa3-b6ff9ff192dc ### Database changes none ### External dependencies none
adam added the type: feature label 2025-12-29 21:21:37 +01:00
adam closed this issue 2025-12-29 21:21:37 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 22, 2024):

When selecting dropdown variables in a custom script, update the URL immediately with the currently selected options, so it can be easily bookmarked.

I'm afraid this is not a tenable proposal, but I suspect the proposal in #9609 would suit your use case.

@jeremystretch commented on GitHub (May 22, 2024): > When selecting dropdown variables in a custom script, update the URL immediately with the currently selected options, so it can be easily bookmarked. I'm afraid this is not a tenable proposal, but I suspect the proposal in #9609 would suit your use case.
Author
Owner

@llamafilm commented on GitHub (May 23, 2024):

That other issue might help, depending how it’s implemented. If you add a single button Rerun with same values that would not help here.
If, instead, you display the form again with pre-filled values and the ability to edit them, that should work.

To clarify the use case: I want to run the script 10 times with different values, but some of the values are the same (site, location, rack). So I’m trying to save time re-entering those 3 variables every time.

@llamafilm commented on GitHub (May 23, 2024): That other issue might help, depending how it’s implemented. If you add a single button `Rerun with same values` that would not help here. If, instead, you display the form again with pre-filled values and the ability to edit them, that should work. To clarify the use case: I want to run the script 10 times with different values, but some of the values are the same (site, location, rack). So I’m trying to save time re-entering those 3 variables every time.
Author
Owner

@jeremystretch commented on GitHub (May 23, 2024):

Ok, let's wait until #9609 gets implemented and go from there. Feel free to add your use case on that FR.

@jeremystretch commented on GitHub (May 23, 2024): Ok, let's wait until #9609 gets implemented and go from there. Feel free to add your use case on that FR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9722