Allow associating a custom link with multiple object types #5896

Closed
opened 2025-12-29 19:33:58 +01:00 by adam · 4 comments
Owner

Originally created by @florianschendel on GitHub (Jan 7, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.4

Feature type

New functionality

Proposed functionality

Convert the drop down field "Content Type" under custom links to a list field like the "custom field" definition.

Use case

We want to use custom link to jump to the ITIL Ticket system.
image

Actually we have the current ticket number within the description field and want to move these information into a custom_field with a custom_link that pointer to the ticket system.
Actually we have to crate a custom_link defintion for every model but the jinja2 code is always the same.

e. g.
image

Database changes

No response

External dependencies

No response

Originally created by @florianschendel on GitHub (Jan 7, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.4 ### Feature type New functionality ### Proposed functionality Convert the drop down field "Content Type" under custom links to a list field like the "custom field" definition. ### Use case We want to use custom link to jump to the ITIL Ticket system. ![image](https://user-images.githubusercontent.com/33891080/148529089-b72dd1f5-25b0-4562-8402-6e35cc196c7d.png) Actually we have the current ticket number within the description field and want to move these information into a custom_field with a custom_link that pointer to the ticket system. Actually we have to crate a custom_link defintion for every model but the jinja2 code is always the same. e. g. ![image](https://user-images.githubusercontent.com/33891080/148529136-9de1925b-e262-471a-b5ff-c4a95e1a40e1.png) ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:33:58 +01:00
adam closed this issue 2025-12-29 19:33:58 +01:00
Author
Owner

@florianschendel commented on GitHub (Jan 7, 2022):

Hi, forget my request. I see in 3.1.5 its working, i think it was the option --> "Optional choiceVar fields should not force a selection"

@florianschendel commented on GitHub (Jan 7, 2022): Hi, forget my request. I see in 3.1.5 its working, i think it was the option --> "Optional choiceVar fields should not force a selection"
Author
Owner

@florianschendel commented on GitHub (Jan 7, 2022):

Sorry, i thought it fixed my issue but it still there. In 3.1.5 it looks like a multi select field but I can only set one value.

@florianschendel commented on GitHub (Jan 7, 2022): Sorry, i thought it fixed my issue but it still there. In 3.1.5 it looks like a multi select field but I can only set one value.
Author
Owner

@jeremystretch commented on GitHub (Jan 10, 2022):

The main reason we didn't do this originally is that it can be easy to forget that the context required for rendering the custom link must not exceed the set of attributes common to all applicable models. For example, a custom link which applies to both sites and racks cannot rely on a site's time_zone nor on a rack's role, because these attributes are exclusive to either model. Someone who's working on extending a custom link for use by a particular model can easily forget that it must also support other assigned models, resulting in errors when attempting to render the link for those other models.

That said, I'm not really opposed to supporting multiple models. However, it would effect a breaking API change, so it would need to be assigned a milestone. Interested to hear other takes on this.

@jeremystretch commented on GitHub (Jan 10, 2022): The main reason we didn't do this originally is that it can be easy to forget that the context required for rendering the custom link must not exceed the set of attributes common to all applicable models. For example, a custom link which applies to both sites and racks cannot rely on a site's `time_zone` nor on a rack's `role`, because these attributes are exclusive to either model. Someone who's working on extending a custom link for use by a particular model can easily forget that it must also support other assigned models, resulting in errors when attempting to render the link for those other models. That said, I'm not really opposed to supporting multiple models. However, it would effect a breaking API change, so it would need to be assigned a milestone. Interested to hear other takes on this.
Author
Owner

@rodvand commented on GitHub (Feb 1, 2022):

This would ease some of our custom link creations as well. It is a bit of a pain to have to make one link for each model.

I don't think we need to guard custom link creators by only supporting one model at the time. Maybe add a descriptive text to the rendering field saying you have to make sure the variables used are available within both models?

@rodvand commented on GitHub (Feb 1, 2022): This would ease some of our custom link creations as well. It is a bit of a pain to have to make one link for each model. I don't think we need to guard custom link creators by only supporting one model at the time. Maybe add a descriptive text to the rendering field saying you have to make sure the variables used are available within both models?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5896