Custom Fields on related objects via WebHook #8803

Closed
opened 2025-12-29 20:41:28 +01:00 by adam · 4 comments
Owner

Originally created by @Yarli on GitHub (Nov 2, 2023).

NetBox version

v3.3.4

Feature type

Change to existing functionality

Proposed functionality

When a webhook is called for either add or edits, can the dataset include the custom fields on the sub-records ?

It seems currently only the basic (id, display, slug and name) fields are part of the data exported for fields like device role, tenant, site and location etc, when creating a webhook for either a device or virtual machine.

Use case

It would allow users to use custom fields on these sub-record fields to keep NetBox data in sync with a 3rd party databases, typically an asset database etc.

For example: When using a webhook to sync changes made to a device or virtual machine up to an asset database, we would want to expose some of the custom fields on the device role object so that we can link that with the equivalent "asset type" table in our asset database.
eg on the device role we would put an integer field called "Asset Type Record ID" and simply populate this field with the ID for the asset type in our asset database. That way when a new record is added or existing record updated in NetBox, that change can sync through to our asset database, and because the custom field with the ID for the asset type is in that data, we can simply take that and use that to add the record to our asset database.

the only workaround for us would be to ensure the device role names match exactly with our asset database "asset types", which isn't an ideal situation for us.

Plus exposing other custom fields may be beneficial to other users for other use cases as well.

Database changes

No response

External dependencies

No response

Originally created by @Yarli on GitHub (Nov 2, 2023). ### NetBox version v3.3.4 ### Feature type Change to existing functionality ### Proposed functionality When a webhook is called for either add or edits, can the dataset include the custom fields on the sub-records ? It seems currently only the basic (id, display, slug and name) fields are part of the data exported for fields like device role, tenant, site and location etc, when creating a webhook for either a device or virtual machine. ### Use case It would allow users to use custom fields on these sub-record fields to keep NetBox data in sync with a 3rd party databases, typically an asset database etc. For example: When using a webhook to sync changes made to a device or virtual machine up to an asset database, we would want to expose some of the custom fields on the device role object so that we can link that with the equivalent "asset type" table in our asset database. eg on the device role we would put an integer field called "Asset Type Record ID" and simply populate this field with the ID for the asset type in our asset database. That way when a new record is added or existing record updated in NetBox, that change can sync through to our asset database, and because the custom field with the ID for the asset type is in that data, we can simply take that and use that to add the record to our asset database. the only workaround for us would be to ensure the device role names match exactly with our asset database "asset types", which isn't an ideal situation for us. Plus exposing other custom fields may be beneficial to other users for other use cases as well. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurepending closure labels 2025-12-29 20:41:28 +01:00
adam closed this issue 2025-12-29 20:41:28 +01:00
Author
Owner

@schld commented on GitHub (Nov 21, 2023):

I'm having a similar scenario where I would like to include more information in the webhook body than what's currently possible, though not limited to custom fields. This is kind of out of my league so please bear with me, but I think one possible solution would be to add the models to the webhook_worker context, with the help of #13427. That way it would be possible to access all of the models, which would include this FR with custom fields.

Please let me know if it's a viable path then I can have a look at it if I might be able to solve it and suggest a PR.

@schld commented on GitHub (Nov 21, 2023): I'm having a similar scenario where I would like to include more information in the webhook body than what's currently possible, though not limited to custom fields. This is kind of out of my league so please bear with me, but I think one possible solution would be to add the models to the webhook_worker context, with the help of #13427. That way it would be possible to access all of the models, which would include this FR with custom fields. Please let me know if it's a viable path then I can have a look at it if I might be able to solve it and suggest a PR.
Author
Owner

@schld commented on GitHub (Dec 20, 2023):

I've applied my patch locally on our netbox instance and it has been working now for a few weeks. I would happily volunteer as an owner and submit a PR.

@schld commented on GitHub (Dec 20, 2023): I've applied my patch locally on our netbox instance and it has been working now for a few weeks. I would happily volunteer as an owner and submit a PR.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 20, 2024):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Mar 20, 2024): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (May 15, 2024):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (May 15, 2024): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8803