Allow MultiObjectVar to accept input from URL in Custom Scripts #5593

Closed
opened 2025-12-29 19:29:55 +01:00 by adam · 1 comment
Owner

Originally created by @rodvand on GitHub (Nov 2, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.8

Feature type

New functionality

Proposed functionality

Allow a MultiObjectVar to be pre-filled using a URL. This currently works for ObjectVar. Example of ObjectVar script:

from extras.scripts import *
from virtualization.models import VirtualMachine

class ObjectVarTest(Script):
    vm = ObjectVar(
            model=VirtualMachine
            )

    def run(data, commit):
        pass

Here you can pre-fill the variable by passing ?vm=<ID> like this https://your.netbox.install/extras/scripts/ob_var.ObjectVarTest/?vm=13.

Change the variable to a MultiObjectVar and try passing multiple values (https://your.netbox.install/extras/scripts/ob_var.ObjectVarTest/?vm=13&vm=37) . It does not currently work.

Use case

Allow a user to go straight to a custom script with some data pre-filled.

Database changes

None

External dependencies

No response

Originally created by @rodvand on GitHub (Nov 2, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.8 ### Feature type New functionality ### Proposed functionality Allow a MultiObjectVar to be pre-filled using a URL. This currently works for ObjectVar. Example of ObjectVar script: ``` from extras.scripts import * from virtualization.models import VirtualMachine class ObjectVarTest(Script): vm = ObjectVar( model=VirtualMachine ) def run(data, commit): pass ``` Here you can pre-fill the variable by passing `?vm=<ID>` like this https://your.netbox.install/extras/scripts/ob_var.ObjectVarTest/?vm=13. Change the variable to a MultiObjectVar and try passing multiple values (https://your.netbox.install/extras/scripts/ob_var.ObjectVarTest/?vm=13&vm=37) . It does not currently work. ### Use case Allow a user to go straight to a custom script with some data pre-filled. ### Database changes None ### External dependencies _No response_
adam added the type: bugstatus: accepted labels 2025-12-29 19:29:55 +01:00
adam closed this issue 2025-12-29 19:29:55 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 17, 2021):

Really a bug rather than a feature. This works as expected with the same type of field elsewhere in NetBox.

@jeremystretch commented on GitHub (Nov 17, 2021): Really a bug rather than a feature. This works as expected with the same type of field elsewhere in NetBox.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5593