Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Apr 03, 2021 10:22 AM
I would like to be able to determine which table a linked record exists in so that I can parse metadata and apply appropriate data conversions. Am I missing something here?
Apr 03, 2021 11:14 AM
All linked records for a linked record field are in the same table. So you would need to know the table ahead of time.
Apr 03, 2021 03:13 PM
Welcome to the Airtable community!
Which API are you using? If you are using the scripting, custom apps, or metadata api, you can get the id of the linked table from the field options of the linked record field. The field options for a linked record field are documented here and here.
Of course, you need to know the current table in order to get field option information. If you have only the record, there is no easy way to tell which table it belongs to.
If you are using only the standard REST API, you cannot get the information from the standard REST API.
Apr 07, 2021 08:26 AM
I am using the REST API. It looks like the Enterprise API has methods that can write the ‘Field Type’ but not read. This seems like a missing feature. I will have to either hard-code table names or parse every table to identify which table a linked record points to.
Apr 07, 2021 09:09 AM
I do not know if the Enterprise API has access to base schema metadata, but it might. (I do not have access to the Enterprise API.)
Can you clarify on how you plan to parse every table to identify which table a linked record points to? It is not possible to identify the table from only the record id, unless you try to get that record id from every table in the base, which is a waste of resources.
On the other hand, hardcoding the linked table should not be no more onerous than hardcoding any other table name, as long as the base schema is stable.
Apr 07, 2021 09:30 AM
In this case, the base schema is not stable. Hardcoding is not my favorite technique.
…get that record id from every table in the base, which is a waste of resources.
Yes, it would be a waste of resources but it seems the only way to do this with code at the moment.
Apr 07, 2021 09:35 AM
Building an api solution when the base schema is not stable is challenging. Best of luck to you.