Oct 12, 2021 01:40 PM
I’ve made an Airtable script to get some info automatically calling an API after populating a single field. Everything is cool besides the fact that one of the fields it’s a linked field to another table.
In this case, I would first have to create a new record in the other table and then link it (via the record id) to the table in the first “main” table.
I’d like to understand if there’s a way to get back the ID of a newly created record to link the record in the main one. I could read the values in the whole table after creation, filter them and get the ID of the created field. Tho it seems very inefficient since I’d have to read the whole thing just for a single value.
I’ve read through the docs but I couldn’t find anything about this use case. Is there a more elegant way that I’m missing?
Thanks
Solved! Go to Solution.
Oct 12, 2021 03:52 PM
Welcome to the community, @Giacomo_Melzi! :grinning_face_with_big_eyes: If you’re using your script to create a new Airtable record, you’ll have the ID automatically. When using the createRecordAsync()
table method, what’s returned is the ID of the created record.
Oct 12, 2021 03:52 PM
Welcome to the community, @Giacomo_Melzi! :grinning_face_with_big_eyes: If you’re using your script to create a new Airtable record, you’ll have the ID automatically. When using the createRecordAsync()
table method, what’s returned is the ID of the created record.
Oct 12, 2021 10:58 PM
Thanks @Justin_Barrett! I feel a little dumb since it was actually in the name of the variable in the docs. I was looking somewhere else :grinning_face_with_sweat:
let recordId = await table.createRecordAsync
Thanks!