You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/customization/custom-scripts.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -404,6 +404,61 @@ A complete date & time. Returns a `datetime.datetime` object.
404
404
405
405
Custom scripts can be run via the web UI by navigating to the script, completing any required form data, and clicking the "run script" button. It is possible to schedule a script to be executed at specified time in the future. A scheduled script can be canceled by deleting the associated job result object.
406
406
407
+
#### Prefilling variables via URL parameters
408
+
409
+
Script form fields can be prefilled by appending query parameters to the script URL. Each parameter name must match the variable name defined on the script class. Prefilled values are treated as initial values and can be edited before execution. Multiple values can be supplied by repeating the same parameter. Query values must be percent‑encoded where required (for example, spaces as `%20`).
410
+
411
+
Examples:
412
+
413
+
For string and integer variables, when a script defines:
414
+
415
+
```python
416
+
from extras.scripts import Script, StringVar, IntegerVar
417
+
418
+
classMyScript(Script):
419
+
name = StringVar()
420
+
count = IntegerVar()
421
+
```
422
+
423
+
the following URL prefills the `name` and `count` fields:
|`IPAddressWithMaskVar`| IP address with mask |`?addr=192.0.2.1/24`|
452
+
|`IPNetworkVar`| IP network prefix |`?network=2001:db8::/64`|
453
+
|`DateVar`| date `YYYY-MM-DD`|`?date=2025-01-05`|
454
+
|`DateTimeVar`| ISO datetime |`?when=2025-01-05T14:30:00`|
455
+
|`FileVar`| — (not supported) | — |
456
+
457
+
!!! note
458
+
- The parameter names above are examples; use the actual variable attribute names defined by the script.
459
+
- For `BooleanVar`, only an empty value (`?enabled=`) unchecks the box; any other value including `false` or `0` checks it.
460
+
- File uploads (`FileVar`) cannot be prefilled via URL parameters.
461
+
407
462
### Via the API
408
463
409
464
To run a script via the REST API, issue a POST request to the script's endpoint specifying the form data and commitment. For example, to run a script named `example.MyReport`, we would make a request such as the following:
0 commit comments