Event Rule / Add snapshots and event_type fields when passing data to custom script #11037

Closed
opened 2025-12-29 21:39:26 +01:00 by adam · 1 comment
Owner

Originally created by @chaeynz on GitHub (Apr 16, 2025).

NetBox version

4.2.7

Feature type

Change to existing functionality

Proposed functionality

ab0a1f0bbc/netbox/extras/events.py (L127)

Hello, currently the Event Rule for scripts only passes event_data.

Would it be possible to add functionality to pass snapshots and event_type into the script aswell?

I am thinking to encapsulate it like

{
  "data": {
    "data": event_data,
    "snapshots": snapshots,
    "event_type": event_type
  }
}

instead of how it currently is

{
  "data": event_data
} 

Use case

Ability to access the event_type inside the script to do different actions depending on whether the object was removed or added.

The only problem is that everyone who created scripts that use data from event rules would have to rewrite the scripts :')

Database changes

No response

External dependencies

No response

Originally created by @chaeynz on GitHub (Apr 16, 2025). ### NetBox version 4.2.7 ### Feature type Change to existing functionality ### Proposed functionality https://github.com/netbox-community/netbox/blob/ab0a1f0bbcbdd43a58167348b15e0f2ea12c3dcb/netbox/extras/events.py#L127 Hello, currently the Event Rule for scripts only passes event_data. Would it be possible to add functionality to pass snapshots and event_type into the script aswell? I am thinking to encapsulate it like ``` { "data": { "data": event_data, "snapshots": snapshots, "event_type": event_type } } ``` instead of how it currently is ``` { "data": event_data } ``` ### Use case Ability to access the event_type inside the script to do different actions depending on whether the object was removed or added. The only problem is that everyone who created scripts that use data from event rules would have to rewrite the scripts :') ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: duplicatetopic: event rules labels 2025-12-29 21:39:26 +01:00
adam closed this issue 2025-12-29 21:39:26 +01:00
Author
Owner

@chaeynz commented on GitHub (Apr 16, 2025):

duplicate of #14896

@chaeynz commented on GitHub (Apr 16, 2025): duplicate of #14896
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11037