Help

Can I create a two-way link between records of the same table?

Topic Labels: Base design
170 6
cancel
Showing results for 
Search instead for 
Did you mean: 
StoragePilot
4 - Data Explorer
4 - Data Explorer

I'm trying to create a simple contact database of names.  When I have several names that happen to be related (ie of the same family), I'd like to link each of them to each other to show those relationships.  I can create a link to other people in the same table ("People") for example John Doe is related to Jane Doe, but when I go to Jane Doe, I don't see the relationship to John Doe.  It doesn't seem to be two-way.  Am I missing something?

6 Replies 6

No, unfortunately, this is one of the biggest flaws in Airtable.

Airtable doesn’t offer automatic backlinking within the same table

I would definitely submit this as a feature request to support@airtable.com, but people have been requesting this for 10 years now, and no improvements have been made on this front.

Your only 2 options for this would be to:

(1) Write a custom JavaScript to handle this for you.

Two scripts that do this are available here and here, but they are very old scripts, so I don't know if they still work anymore.

or

(2) For a no-code way of doing this that doesn't require writing any scripts at all, you can create your own custom automation to create your own backlinks.

You may be able to do this with Airtable's automations, now that they have added the ability to "find records" in their automations.

However, I often recommend that people try using Make’s advanced automations for Airtable, which gives you much more power & control than Airtable's automations. But there is a very steep learning curve with Make (i.e. it could take days or weeks to learn), which is why I’ve assembled a bunch of Make training resources in this thread. For example, here is one of the ways that you could instantly trigger a Make automation from Airtable.

Hope this helps! If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld

I'm afraid not.  Using a script's going to be your best bet for this I think, and the one I usually recommend is @kuovonne's which you can find here: https://kuovonne.gumroad.com/l/joRkE, and she's got a forum post about it here: https://community.airtable.com/t5/show-tell/kuovonne-s-script-store/m-p/125509/highlight/true#M2170

Trying to do this with automations is quite the endeavour, and if you do try to do it one of the biggest challenges is needing to unlink stuff, i.e. if John is linked to Jane, and you remove that link on John's record, you'll now need to figure out how to unlink John from Jane's record

The issue here comes from the fact that, when the automation triggers, the triggering record doesn't contain the infromation that it was previously linked to Jane, does that make sense?  And so you're either going to need to store the historical links, or loop through all the other records and then do logic from there.  This would probably take a couple of hours to figure out and if one was doing it within Airtable you'd need to chain automations together and create a helper table I think

 
Omohungryman
4 - Data Explorer
4 - Data Explorer

It sounds like you're trying to create a two-way relationship in your contact database. To achieve this, you’ll need to ensure that the relationship is bidirectional. Here’s how you can do it:

  1. Add a Relationship Field: In your "People" table, create a relationship field (e.g., "Related To") that links to the same table.

  2. Link Both Records: When linking John Doe to Jane Doe, make sure to also link Jane Doe back to John Doe in the same field. This ensures the relationship is two-way.

  3. Database Tools: If you're using a database tool like Airtable or Notion, they often have built-in features for bidirectional relationships. Check the documentation for your specific tool to see if this is supported.

If you’re working with a custom solution, you might need to write a script or use a relational database (like SQL) to enforce bidirectional relationships. Let me know if you need more details!

This one seems like a ChatGPT response!

VikasVimal
6 - Interface Innovator
6 - Interface Innovator

Anyways, you'll need an automation.

2 ways:

Single linked record field, or two linked record fields.

for a single linked record field, you basically need to maintain the same set of linked records across all records linked to any single record. So, if A is linked to B and C, the linked record field for B should have A and C, and C should have A and B. If you add D to A, it'll be added to B and C as well, and D will be linked to A, B , C in turn.

You'll need to trigger this automation to run once a day or once per hour. Then second step, run a script that picks up all the records and creates an internal array sorted by last modified time. It'll then transform the array to group by groups of linked contacts, some tweaking  and you'll have a list of groups and the records in that group. Then it'd copy the records in each group to its contributing records. It is a bit tricky to set up and might be prone to issues. But it'll work for use cases where you need to maintain family groups.

The second way is to have 2 linked record fields and have a parent-child relationship. One linked record would be for parents, and the other for children. If you make the parent field as the primary, you can update the child field using an automation or script. The script would find all records, filter the most recently updated, and update the child record field of the parents.

Third option is to have a 'family' table and link records to the family.

I provide consults: meet.vikasvimal.com

While my "Same Table Backlinks" script works for maintaining links in the same table, I suggest you consider creating a new "Family" table instead. Then link everyone in the same family to the same family record. You can use lookups or rollups to see everyone in the family.

In general, family relationships can be challenging to map in a relational database because family relationships can be very complicated. If you want something more than just who is in the same family, you will need to think hard about which relationships you want to model and what you will do when you encounter a situation that does not fit into you model.