Custom Scripts - Can't Get ObjectVar Variables to Work #10605
-
Hello, the issue is pretty much all there in the title. The script I'm trying to test is below, along with the error NetBox is outputing when I navigate to the scripts page. It seems to work fine with any of the other built-in variables like TextVar, StringVar, etc. I've tried changing the model to various others as well as using lower-case in case it was case sensitive in some way and am at a loss. Any thoughts?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You need to import the Device model:
You can refer to the example at the bottom of the docs: https://demo.netbox.dev/static/docs/customization/custom-scripts/ |
Beta Was this translation helpful? Give feedback.
You need to import the Device model:
from dcim.models import Device
You can refer to the example at the bottom of the docs:
https://demo.netbox.dev/static/docs/customization/custom-scripts/