Skip to content

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

@rodvand

Description

@rodvand

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

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions