I'm working on a script that will move records (and its child records) from one base to another. It's mostly working but one issue I'm running into is figuring out the table information of a linked record. For instance, I have two tables: Companies and Users. A User belongs to a Company. If I wanted to move User 1, all the information and Company 1 with all its information, I need to know table information for both so I can grab the fields for each table and create the new records.
So when I have a User.company, I'm given all the field information but nothing about the table. Is there an easy way to look the table info up? I was hoping tableId was attached to the field or some identifier that shows which table this field is to but I don't see it. Since I can rename a linked field name, I can't use the field name to search for the table. For instance, I can rename the Company field to Organization in the User table so searching for an "Organization" table wouldn't help.
Any suggestions? I feel like I'm missing something simple. Either field.tableId or base.searchTableByFieldId or something I can use.