Prepopulation of custom fields #1164

Closed
opened 2025-12-29 16:29:39 +01:00 by adam · 3 comments
Owner

Originally created by @AnythingOverIP on GitHub (Aug 9, 2017).

Issue type: Feature request

**Python version: 3.5.2
**NetBox version: 2.1.2

I would like to be able to pre-populate fieds.

In example, for each sites, I have Custom fields that should contain URLs that we use to document those. We use the "Facility" field to put in the location code (A####)

this is similar to https://github.com/digitalocean/netbox/issues/969 and https://github.com/digitalocean/netbox/issues/600

So for each URL custom property, I would like to set a default value of the base URL + the content of facility field for this site:
* http://internal.site.com/locations/{facility}
* http://internal.site.com/{facility}/folder
* http://internal.site.com/default.aspx?ABBR=?{facility}

The admin should have the luxury to override the default value if needed.

It would be useful to be able to refer not only to the out of the box field, but also to other Custom Fields. An example would be Lat Long coordinates being reused for a link towards a map provider site.

Originally created by @AnythingOverIP on GitHub (Aug 9, 2017). ### Issue type: Feature request **Python version: 3.5.2 **NetBox version: 2.1.2 I would like to be able to pre-populate fieds. In example, for each sites, I have Custom fields that should contain URLs that we use to document those. We use the "Facility" field to put in the location code (A####) this is similar to https://github.com/digitalocean/netbox/issues/969 and https://github.com/digitalocean/netbox/issues/600 So for each URL custom property, I would like to set a default value of the base URL + the content of facility field for this site: * http://internal.site.com/locations/{facility} * http://internal.site.com/{facility}/folder * http://internal.site.com/default.aspx?ABBR=?{facility} The admin should have the luxury to override the default value if needed. It would be useful to be able to refer not only to the out of the box field, but also to other Custom Fields. An example would be Lat Long coordinates being reused for a link towards a map provider site.
adam closed this issue 2025-12-29 16:29:39 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 9, 2017):

Custom fields already allow you to set a default value. What are you proposing that is not covered by #600 or #969?

@jeremystretch commented on GitHub (Aug 9, 2017): Custom fields already allow you to set a default value. What are you proposing that is not covered by #600 or #969?
Author
Owner

@AnythingOverIP commented on GitHub (Aug 9, 2017):

Indeed, I can have a default value, but it is my understanding that I cannot use variables that refer to other fields of the given site, right?

I currently have default values that I edit manually every time I create a site, and type in the location code. For each site I create into NetBox, I have about 5 or 6 URLS in custom properties to maintain, that could be automated by those variables.

The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field.
Something like http://internal.site.com/locations/{facility} would then show http://internal.site.com/locations/A1234 when not in edit mode (A1234 being the content of the Facility field.

#600 or #969 were really axed towards the devices information. I created this FR to ensure it's captured that it would be also available for site information. I also haven't seen anybody that were requiring to reference a custom field into another custom field. It would be useful when storing LAT/LONG coordinates in custom fields, to be able to recreate an URL from those...

@AnythingOverIP commented on GitHub (Aug 9, 2017): Indeed, I can have a default value, but it is my understanding that I cannot use variables that refer to other fields of the given site, right? I currently have default values that I edit manually every time I create a site, and type in the location code. For each site I create into NetBox, I have about 5 or 6 URLS in custom properties to maintain, that could be automated by those variables. The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field. Something like http://internal.site.com/locations/{facility} would then show http://internal.site.com/locations/A1234 when not in edit mode (A1234 being the content of the Facility field. #600 or #969 were really axed towards the devices information. I created this FR to ensure it's captured that it would be also available for site information. I also haven't seen anybody that were requiring to reference a custom field into another custom field. It would be useful when storing LAT/LONG coordinates in custom fields, to be able to recreate an URL from those...
Author
Owner

@jeremystretch commented on GitHub (Aug 9, 2017):

The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field.

There's no reason to duplicate the value of the facility field in the database. The {facility} placeholder would be rendered upon request and replaced with the value of the site's facility field. This is what #600/#969 aim to implement. I'm going to close this out as I'm confident your use case will be addressed by the implementation of one or both of those FRs.

@jeremystretch commented on GitHub (Aug 9, 2017): > The goal of my use case is when creating a site, when I enter a location code in the facility field and click save, the URLs are updated to include the location code I provided in the facility field. There's no reason to duplicate the value of the facility field in the database. The `{facility}` placeholder would be rendered upon request and replaced with the value of the site's facility field. This is what #600/#969 aim to implement. I'm going to close this out as I'm confident your use case will be addressed by the implementation of one or both of those FRs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1164