Help

Re: Get record id after creation

Solved
Jump to Solution
1439 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Giacomo_Melzi
4 - Data Explorer
4 - Data Explorer

Context

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.

Problem

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

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

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.

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

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.

Giacomo_Melzi
4 - Data Explorer
4 - Data Explorer

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!