Bulk contact-to-object assignments #8074

Closed
opened 2025-12-29 20:32:00 +01:00 by adam · 2 comments
Owner

Originally created by @opericgithub on GitHub (May 16, 2023).

NetBox version

v3. 5.1

Feature type

New functionality

Proposed functionality

Currently there is no gui possibility to bulk-assign many contacts to many objects. The only way we have found is by directly modifying database with "insert into tenancy.contact (...) values (...)(...) etc " which may be very hazardous.

There should be an gui option to link the ID of the contact with the ID of the object, let's say a device.

Use case

We have thousands of devices representing physical IP phones, and also have thousands of contacts, each of them representing the phone number of the IP phone.

We would like to link all of the contacts to all of the devices, but there is no way to do that by bulk editing (importing) devices because there is no available contact field option.

If such field existed, it would be easy to link let's say a list of device id's with a list of contact id's.

As for now, we have to edit thousands of devices one-by-one and click "add a contact" button on every single one of them.

Database changes

No response

External dependencies

No response

Originally created by @opericgithub on GitHub (May 16, 2023). ### NetBox version v3. 5.1 ### Feature type New functionality ### Proposed functionality Currently there is no gui possibility to bulk-assign many contacts to many objects. The only way we have found is by directly modifying database with "insert into tenancy.contact (...) values (...)(...) etc " which may be very hazardous. There should be an gui option to link the ID of the contact with the ID of the object, let's say a device. ### Use case We have thousands of devices representing physical IP phones, and also have thousands of contacts, each of them representing the phone number of the IP phone. We would like to link all of the contacts to all of the devices, but there is no way to do that by bulk editing (importing) devices because there is no available contact field option. If such field existed, it would be easy to link let's say a list of device id's with a list of contact id's. As for now, we have to edit thousands of devices one-by-one and click "add a contact" button on every single one of them. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: duplicate labels 2025-12-29 20:32:00 +01:00
adam closed this issue 2025-12-29 20:32:00 +01:00
Author
Owner

@Dakson13 commented on GitHub (May 17, 2023):

I agree with this proposed feature.Here where i work at, we have over ten thousand tenants and we have to enter their contact information for each of them. In order to do that, we have to choose contact first and then contact role for each of them.So this feature whould help us a lot, because adding contacts to each tenant one by one isn't feasible.
As @opericgithub we have also poked around the netbox database. While poking around the database we found out that you can allocate CONTACT ASSIGNEMENTS using the following query:

insert into public.tenancy_contactassignment ( object_id, priority, contact_id, content_type_id, role_id )
values
('2','','6311','73','4'),
('3','','6312','73','4'),
('4','','6313','73','4')...

The relevant columns (first and third) in this query are object_id and contact_id, which we used to associate tenants with their contacts. This import works, so we can achieve the desired result with this, but we are afraid of compromising the integrity of the database. And we also think this is not a good way to assign contacts.
It seems to us that this is no different than any other bulk import we do via the GUI. We hope that this functionality will be implemented in one of the next versions of Netbox, because it would help us immensely.

@Dakson13 commented on GitHub (May 17, 2023): I agree with this proposed feature.Here where i work at, we have over ten thousand tenants and we have to enter their contact information for each of them. In order to do that, we have to choose contact first and then contact role for each of them.So this feature whould help us a lot, because adding contacts to each tenant one by one isn't feasible. As @opericgithub we have also poked around the netbox database. While poking around the database we found out that you can allocate CONTACT ASSIGNEMENTS using the following query: insert into public.tenancy_contactassignment ( object_id, priority, contact_id, content_type_id, role_id ) values ('2','','6311','73','4'), ('3','','6312','73','4'), ('4','','6313','73','4')... The relevant columns (first and third) in this query are object_id and contact_id, which we used to associate tenants with their contacts. This import works, so we can achieve the desired result with this, but we are afraid of compromising the integrity of the database. And we also think this is not a good way to assign contacts. It seems to us that this is no different than any other bulk import we do via the GUI. We hope that this functionality will be implemented in one of the next versions of Netbox, because it would help us immensely.
Author
Owner

@jeremystretch commented on GitHub (May 25, 2023):

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #11307 for further discussion.

@jeremystretch commented on GitHub (May 25, 2023): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #11307 for further discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8074