- Home
- Community
- Ask the Community
- Development & APIs
- New Script: Same Table Linked Records Backlinks
New Script: Same Table Linked Records Backlinks
- March 16, 2020
- 64 replies
- 40 views

- Inspiring
- 351 replies
64 replies

- Inspiring
- 262 replies
- July 14, 2021
Could you please point out where the recursion and inheritance occur?
I’m not seeing either.
I also find a few things in the script to be rather curious, such as line 67:
if(!currentAddedKidParents.includes( { id: modifiedRecord.id, name: modifiedRecord.name })) {
I bet this line does not do what the author intended. This condition will always evaluate as true. When using .includes()
with an array of objects, JavaScript checks if the objects themselves are included, not the contents of the object. As written, the newly created object will never be included in the array, even if the array has an object with the same property values. Thus the includes()
will always be false, and the !
negates that , making the condition always true.
There are a few other things in the script that imply that the author had limited experience with Airtable scripting when he wrote the script. For example, every pair of updateRecordAsync
calls could be condensed into a single call, which would cut the run time almost in half. (And there are several other changes that could speed up the script, such as not having updateRecordAsync
inside a loop.)
Could you please point out where the recursion and inheritance occur?
I’m not seeing either.
Sure, I haven’t been wrong all day, got to start somewhere :grinning_face_with_sweat: : is the findChildren function not both recursive and prototypal in places? The latter because it implicitly inherits the getRecord method and just rolls with it?
The former because of the way it creates its tree object, for example? Its async sync queue trigger is kind of recursive as well, it has a single stop/start condition and the interpreter is left to figure out the best ratios. This all comes together to form a solution that should work in any base, regardless of size, as syncing part keeps it keeps reusing its few functions for roughly (records.length/50)+1 cycles. or other properties - assuming the initial setup was correct.
Basically, it should work in any base, regardless of size and other properties, because it keeps switching between filling the queue and clearing it, for as long as needed.
Why do I have a feeling I’m flunking math and just how many scripts have been posted so far, I can’t even find that line 67. The thing I’m looking at and was looking at originally is a gist, I’m leaving just the canonical url here because some filter keeps complaining about repost attempts:
/on2air/b68450a877ab99fe4a93ef7f9c387568
And my original point was that this was good, not that the other thing was bad.
- Brainy
- 6000 replies
- July 14, 2021
Could you please point out where the recursion and inheritance occur?
I’m not seeing either.
Sure, I haven’t been wrong all day, got to start somewhere :grinning_face_with_sweat: : is the findChildren function not both recursive and prototypal in places? The latter because it implicitly inherits the getRecord method and just rolls with it?
The former because of the way it creates its tree object, for example? Its async sync queue trigger is kind of recursive as well, it has a single stop/start condition and the interpreter is left to figure out the best ratios. This all comes together to form a solution that should work in any base, regardless of size, as syncing part keeps it keeps reusing its few functions for roughly (records.length/50)+1 cycles. or other properties - assuming the initial setup was correct.
Basically, it should work in any base, regardless of size and other properties, because it keeps switching between filling the queue and clearing it, for as long as needed.
Why do I have a feeling I’m flunking math and just how many scripts have been posted so far, I can’t even find that line 67. The thing I’m looking at and was looking at originally is a gist, I’m leaving just the canonical url here because some filter keeps complaining about repost attempts:
/on2air/b68450a877ab99fe4a93ef7f9c387568
And my original point was that this was good, not that the other thing was bad.
Maybe we’re talkin about different scripts here.
I was replying to this part of your post …
I thought your comments above were referring to the second script (theomichel/backlinks.js) because it has exactly 130 lines of code.
This script does not include the findChildren
function. I also do not see any recursion or prototypical inheritance in this script.
On the other hand, the first script (on2air/same-table-backlinks.js) has 147 lines of code, and does include the findChildren
function.
The findChildren
function is not recursive. It does not call itself. Only syncLinks
calls findChildren
.
Thank you for pointing out this example of what you meant by prototypical inheritance. I was looking for something else, not a case of an object from the api using a method defined in the api.
Both scripts should work in any base of any size. (My script does as well.)
This is why I was looking for those features in the script. Both scripts have their merits, and both scripts have things that could be cleaned up.
I think the main concept missing when comparing the two scripts is that they serve different purposes.
- One script is meant to be run manually to create backlinks in bulk, and requires only two linked same-table link fields.
- The other script is meant to be run as an automation to maintain a system of same-table links that actually requires four same-table link fields.
- Brainy
- 6000 replies
- December 9, 2021
Scripting has undergone a lot of changes since this thread was started.
I decided to write a new version of the script to take advantage of some new features, such as script settings, that lets the script remember the table and fields without having to touch the code.
This version has a few differences from the original and is entirely my own code, although aspects of the algorithm are similar.
- uses script settings for setting table & fields (which did not exist before)
- works on only one table, not multiple tables
- does not allow limiting records to a view
- various speed improvements and error checking
This script is best used as a batch update when first setting up back links. I also have a matching automation script for when either the link or the backlink is updated, without needing to store previous versions of links. If you are interested in the automation script, please book an appointment with me.
My automation script for maintaining same-table backlinks is now available on my Gumroad store.

- Known Participant
- 16 replies
- December 22, 2021
Scripting has undergone a lot of changes since this thread was started.
I decided to write a new version of the script to take advantage of some new features, such as script settings, that lets the script remember the table and fields without having to touch the code.
This version has a few differences from the original and is entirely my own code, although aspects of the algorithm are similar.
- uses script settings for setting table & fields (which did not exist before)
- works on only one table, not multiple tables
- does not allow limiting records to a view
- various speed improvements and error checking
This script is best used as a batch update when first setting up back links. I also have a matching automation script for when either the link or the backlink is updated, without needing to store previous versions of links. If you are interested in the automation script, please book an appointment with me.
This is great @kuovonne, we need this (for parent / child relationships) but we also need one for sibling relationships… i.e. only one linked field with multiple entries.
E.g.
Running the script on:
Name Siblings
1 2,3
2
3
Should lead to:
Name Siblings
1 2,3
2 1,3
3 1,2
Is this possible? Or is there a workaround?
I’ve tried achieving this with automations, breaking out sibling IDs as separate formula fields and using lookups to create the updates… however this creates a recursive loop which I can’t seem to stop.
Help would be greatly appreciated!
- Brainy
- 6000 replies
- December 22, 2021
This is great @kuovonne, we need this (for parent / child relationships) but we also need one for sibling relationships… i.e. only one linked field with multiple entries.
E.g.
Running the script on:
Name Siblings
1 2,3
2
3
Should lead to:
Name Siblings
1 2,3
2 1,3
3 1,2
Is this possible? Or is there a workaround?
I’ve tried achieving this with automations, breaking out sibling IDs as separate formula fields and using lookups to create the updates… however this creates a recursive loop which I can’t seem to stop.
Help would be greatly appreciated!
It is possible to have a script to update sibling relationships. There are two potential scripts: a button script for establishing siblings relationships for existing records, and an automation script for maintaining sibling relationships on an ongoing basis. An automation script can include logic to avoid the recursive loop of unending automation runs. Please let me know if you are interested in hiring me to write these scripts.
However, usually sibling relationships are managed through a parent record. All of the siblings are linked to the same parent. The parent rolls up information about all the children/siblings, and then another rollup field passes the necessary information back down to all the children/siblings.

- Known Participant
- 16 replies
- December 23, 2021
It is possible to have a script to update sibling relationships. There are two potential scripts: a button script for establishing siblings relationships for existing records, and an automation script for maintaining sibling relationships on an ongoing basis. An automation script can include logic to avoid the recursive loop of unending automation runs. Please let me know if you are interested in hiring me to write these scripts.
However, usually sibling relationships are managed through a parent record. All of the siblings are linked to the same parent. The parent rolls up information about all the children/siblings, and then another rollup field passes the necessary information back down to all the children/siblings.
Hi @kuovonne thanks for offering your help. Yes, I’d appreciate your help with this. I’ve explored a parent record approach, but this seems more clunky. Since our focus is on each individual client, it’s best to know specifically who their family members / relationships are (spouse, children, parents, siblings, in-laws, extended family).
I’ve already used your script for spouse / children. Thanks for posting that.
How can we liaise with you to get you to write an automation(s) for siblings, in-laws and extended family in our contacts table?
- Brainy
- 6000 replies
- December 23, 2021
Hi @kuovonne thanks for offering your help. Yes, I’d appreciate your help with this. I’ve explored a parent record approach, but this seems more clunky. Since our focus is on each individual client, it’s best to know specifically who their family members / relationships are (spouse, children, parents, siblings, in-laws, extended family).
I’ve already used your script for spouse / children. Thanks for posting that.
How can we liaise with you to get you to write an automation(s) for siblings, in-laws and extended family in our contacts table?
@Tristan_Scifo You can book an appointment with me to discuss your needs. I use a booking calendar with a rolling two week basis, so I currently have only a few appointment slots available, but appointments on future days will open up as they come in the two week window.
It sounds like the same-table backlinks scripts works for parents/children, and spouses. Scripts for sibling same-table links is also doable. However, dealing with in-laws, extended family, and other blended family relationships can be0 tricky. For example, when adding a child to one spouse, should that child become a child of the other spouse and siblings of the other spouse’s children? These complex relationships might be more than you want to handle automatically.
- Inspiring
- 329 replies
- January 25, 2022
We have an automatic linking feature - Same Table Linked Records plus 60+ more Airtable functions in the On2Air Actions app.
Here’s a tutorial:

- Inspiring
- 6 replies
- April 29, 2022
Scripting has undergone a lot of changes since this thread was started.
I decided to write a new version of the script to take advantage of some new features, such as script settings, that lets the script remember the table and fields without having to touch the code.
This version has a few differences from the original and is entirely my own code, although aspects of the algorithm are similar.
- uses script settings for setting table & fields (which did not exist before)
- works on only one table, not multiple tables
- does not allow limiting records to a view
- various speed improvements and error checking
This script is best used as a batch update when first setting up back links. I also have a matching automation script for when either the link or the backlink is updated, without needing to store previous versions of links. If you are interested in the automation script, please book an appointment with me.
This is super helpful. Works like a charm. Thank you.

- Inspiring
- 6 replies
- May 3, 2022
Scripting has undergone a lot of changes since this thread was started.
I decided to write a new version of the script to take advantage of some new features, such as script settings, that lets the script remember the table and fields without having to touch the code.
This version has a few differences from the original and is entirely my own code, although aspects of the algorithm are similar.
- uses script settings for setting table & fields (which did not exist before)
- works on only one table, not multiple tables
- does not allow limiting records to a view
- various speed improvements and error checking
This script is best used as a batch update when first setting up back links. I also have a matching automation script for when either the link or the backlink is updated, without needing to store previous versions of links. If you are interested in the automation script, please book an appointment with me.
Maybe one suggestion:
Suppose you have 3 columns: organizations, is_funding, is_funded_by
They are populated like in picture 1.
Then you make some manual changes, resulting in picture 2.
Then you run the script with is_funded_by as Original Link and is_funding as Back Linked Field, expecting the dependent field of both of your changes to be populated automatically.
But the result is picture 4
And if instead you had done 'is_funding as the Original Link and is_funded_by as the Back Linked Field, the result would have been
But the result you’d want is:
With either solution you lose data. It is possible to avoid this problem by running the script every time before you make a change in a field that is dependent on a field that you just made a change in, but this is inconvenient, especially when lots of changes are made in short periods of time.
Maybe the script could give a warning if it detects that you are about to make changes that would overwrite unsaved changes in dependent fields. But this could get annoying fast. So maybe at the start the script could temporarily create an extra column in which it pastes the unsaved changes from one side of the mutually dependent columns, and then once the script has done its thing it adds the unsaved elements that got overwritten but a copy of which was saved in the temporary column, and then it automatically deletes that temporary column before finishing.
(it’s also possible that the script already solves this problem but that I am just not using it properly)
- Brainy
- 6000 replies
- May 3, 2022
Maybe one suggestion:
Suppose you have 3 columns: organizations, is_funding, is_funded_by
They are populated like in picture 1.
Then you make some manual changes, resulting in picture 2.
Then you run the script with is_funded_by as Original Link and is_funding as Back Linked Field, expecting the dependent field of both of your changes to be populated automatically.
But the result is picture 4
And if instead you had done 'is_funding as the Original Link and is_funded_by as the Back Linked Field, the result would have been
But the result you’d want is:
With either solution you lose data. It is possible to avoid this problem by running the script every time before you make a change in a field that is dependent on a field that you just made a change in, but this is inconvenient, especially when lots of changes are made in short periods of time.
Maybe the script could give a warning if it detects that you are about to make changes that would overwrite unsaved changes in dependent fields. But this could get annoying fast. So maybe at the start the script could temporarily create an extra column in which it pastes the unsaved changes from one side of the mutually dependent columns, and then once the script has done its thing it adds the unsaved elements that got overwritten but a copy of which was saved in the temporary column, and then it automatically deletes that temporary column before finishing.
(it’s also possible that the script already solves this problem but that I am just not using it properly)
The button script that I posted in this thread is not designed to deal with manual changes in both fields. It is designed to have one field as the authority on the relationship.
If you want to be able to manage the relationships by editing either column, you can buy my same table back link scripts and set it up the automation script in two different mirroring automations.

- Participating Frequently
- 8 replies
- December 27, 2022
Thanks for this script which is great. In my case I input the Parent relationship, and use the script to auto-generate the Child relationship as a separate linked field.
I wondered, is there a way to use a similar technique to populate a single linked field with the children of "all generations" (i.e. grandchildren, great-grandchildren etc.) rather than just the "direct" children as currently?

- Known Participant
- 15 replies
- February 9, 2023
I think this was mentioned but not adresses.
Would it be possible to slightly change this script to instead update all sibling records. E.g. I have a table that looks like this:
Given that both projects B and C are related to Project A. I would like to indicate that also in the Records of project A, like this:
This is similar to the parent-child records script except here we would like to link all records both ways in one field. Is this possible?
- New Participant
- 1 reply
- May 10, 2023
What is the extention that shows the family relationships in a chart at the beginning of the video?
Reply
Related topics
Google Ads conversion trackingicon
Custom CodeDoes anyone have experience using Google conversion tracking with surveys?icon
Survey Platform (Before March 2021)Impact of Intercept Surveys on Conversion Rate
Website & App InsightsHow do I create a unique link for each distribution method?icon
Survey Platform (Before March 2021)
Most helpful members this week
- ScottWorld
17 likes
- Mike_AutomaticN
17 likes
- DisraeliGears01
7 likes
- kuovonne
7 likes
- gaston
7 likes
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
OKThis file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.
OK