Enable the use of request data in event rules conditions #10970

Closed
opened 2025-12-29 21:38:35 +01:00 by adam · 5 comments
Owner

Originally created by @rodvand on GitHub (Mar 31, 2025).

NetBox version

v4.2.6

Feature type

New functionality

Proposed functionality

Allow users to make use of request data (such as username) when deciding to trigger an event rule.

Use case

Some integrations are shared between systems, so NetBox may update a system using a webhook, and then the same system may update another field in NetBox. So when the second system updates a field in NetBox I want to avoid running a webhook updating the other system again. Basically to avoid a never-ending loop of updates.

As an example I would like to do something like this in an event rule:

"attr": "username",
"negate": true,
"value": "api_othersystem"

If I am to look beyond my own specific need, I can see the need of using the group membership of the user triggering the event as well. Maybe there are multiple systems updating certain fields in NetBox, and you want to group them to make is easier to decide on event rules triggering.

Database changes

No database changes. From what I can see the need is to add some request data (for an example username) to the data dictionary used in this line:
6f78b3d0cd/netbox/extras/events.py (L90)

External dependencies

No response

Originally created by @rodvand on GitHub (Mar 31, 2025). ### NetBox version v4.2.6 ### Feature type New functionality ### Proposed functionality Allow users to make use of request data (such as username) when deciding to trigger an event rule. ### Use case Some integrations are shared between systems, so NetBox may update a system using a webhook, and then the same system may update another field in NetBox. So when the second system updates a field in NetBox I want to avoid running a webhook updating the other system again. Basically to avoid a never-ending loop of updates. As an example I would like to do something like this in an event rule: ``` "attr": "username", "negate": true, "value": "api_othersystem" ``` If I am to look beyond my own specific need, I can see the need of using the group membership of the user triggering the event as well. Maybe there are multiple systems updating certain fields in NetBox, and you want to group them to make is easier to decide on event rules triggering. ### Database changes No database changes. From what I can see the need is to add some request data (for an example username) to the data dictionary used in this line: https://github.com/netbox-community/netbox/blob/6f78b3d0cd109d5a31520d988d1f5479d656e3e0/netbox/extras/events.py#L90 ### External dependencies _No response_
adam added the type: featurecomplexity: mediumtopic: event rules labels 2025-12-29 21:38:35 +01:00
adam closed this issue 2025-12-29 21:38:35 +01:00
Author
Owner

@jnovinger commented on GitHub (Mar 31, 2025):

Related to #14896, possibly also blocked by #14884 ?

@jnovinger commented on GitHub (Mar 31, 2025): Related to #14896, possibly also blocked by #14884 ?
Author
Owner

@bctiemann commented on GitHub (Apr 3, 2025):

TBD which attributes of the request data should be included (we wouldn't want to use literally everything; perhaps some kind of fake request object similar to what is used in custom scripts.

@bctiemann commented on GitHub (Apr 3, 2025): TBD which attributes of the request data should be included (we wouldn't want to use literally everything; perhaps some kind of fake request object similar to what is used in custom scripts.
Author
Owner

@jeremystretch commented on GitHub (Jul 10, 2025):

This seems like it would be covered by #14896, wouldn't it?

@jeremystretch commented on GitHub (Jul 10, 2025): This seems like it would be covered by #14896, wouldn't it?
Author
Owner

@rodvand commented on GitHub (Jul 11, 2025):

This seems like it would be covered by #14896, wouldn't it?

Yes, it seems to cover the same use case.

@rodvand commented on GitHub (Jul 11, 2025): > This seems like it would be covered by #14896, wouldn't it? Yes, it seems to cover the same use case.
Author
Owner

@jeremystretch commented on GitHub (Jul 14, 2025):

Ok, let's fold this into that FR. There are a few other FR that I think fall under this general theme too, but I haven't taken the time to sort them out yet.

@jeremystretch commented on GitHub (Jul 14, 2025): Ok, let's fold this into that FR. There are a few other FR that I think fall under this general theme too, but I haven't taken the time to sort them out yet.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10970