From 78c89829bfebc3ae8f14b8f3f6e6b9396d948c8e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Dec 2023 13:47:52 -0500 Subject: [PATCH] Fixes #14550: Fix changing event rule action type from webhook to script --- netbox/extras/forms/model_forms.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/netbox/extras/forms/model_forms.py b/netbox/extras/forms/model_forms.py index 336c60fef..ff01c6902 100644 --- a/netbox/extras/forms/model_forms.py +++ b/netbox/extras/forms/model_forms.py @@ -307,11 +307,10 @@ class EventRuleForm(NetBoxModelForm): choices.append((str(module), scripts)) self.fields['action_choice'].choices = choices - if self.instance.pk: + if self.instance.pk and self.instance.action_parameters: scriptmodule_id = self.instance.action_object_id script_name = self.instance.action_parameters.get('script_name') self.fields['action_choice'].initial = f'{scriptmodule_id}:{script_name}' - print(self.fields['action_choice'].initial) def init_webhook_choice(self): initial = None