Handle Linked records and select options Part 2

Welcome to the second part of Handle Linked records and select options. This lesson will teach you how to insert data into linked records or select options. Once you learn how to insert, you can use the same syntax and logic for update operations as well. If you haven't read the last part, it's highly recommended to read the last part. Because we will use an explanation of the previous part.

For this lesson, we don't need a new base. So let's directly learn the scripting.

: Code :


await users_data_table.createRecordAsync({
'User': [{'id': 'recc0YrH46y9CKK4R'}]
}
)

Understanding the code:

The above script is for inserting data in linked records. If you notice, it's not the same as simple fields. When you insert data into linked records, you need to specify that the value is id. Also, the format is should be as shown in the code. You need an array and inside the array, you need to put an object. This object will contain 'id' as the key and the second will be the value.

Now Let's learn how you can insert select options.

: Code :

await users_table.createRecordAsync({
'User type':{'name':'Admin'}
}
)

Understanding the code:

If you notice, there are similarities in linked records and select options. In linked records, you need to specify the id and here you need to specify the name. But here you don't need an array. Just an object is enough in value.

That's all. Now you can use this syntax in update operations as well. Also, you can use it in APIs.

Stay connected for more learning lessons.

Feel free to contact me for Airtable consulting service by Clicking Here.

monino solutions logo

COPYRIGHT © 2024 Monino Solutions.