Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Fields on related objects via WebHook #14172

Closed
Yarli opened this issue Nov 2, 2023 · 4 comments
Closed

Custom Fields on related objects via WebHook #14172

Yarli opened this issue Nov 2, 2023 · 4 comments
Labels
pending closure Requires immediate attention to avoid being closed for inactivity type: feature Introduction of new functionality to the application

Comments

@Yarli
Copy link

Yarli commented 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

@Yarli Yarli added the type: feature Introduction of new functionality to the application label Nov 2, 2023
@schld
Copy link

schld commented 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
Copy link

schld commented 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.

Copy link
Contributor

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 github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Mar 20, 2024
Copy link
Contributor

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 github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending closure Requires immediate attention to avoid being closed for inactivity type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

2 participants