Welcome to the Airtable community!
Airtable does not create new records unless it is told to create a new record. There are several ways to tell Airtable to create a new record.
- In the user interface
- Through the REST API ( which your bot probably uses)
- Through an automation
- Through a custom script or app
It sounds like you want the system to create two linked records, and your bot currently creates one using the REST api.
You could have your bot use the info returned by the rest api to create the second linked record.
Or, you could have an Airtable automation create the second linked record whenever a record is created in the first table.
Welcome to the Airtable community!
Airtable does not create new records unless it is told to create a new record. There are several ways to tell Airtable to create a new record.
- In the user interface
- Through the REST API ( which your bot probably uses)
- Through an automation
- Through a custom script or app
It sounds like you want the system to create two linked records, and your bot currently creates one using the REST api.
You could have your bot use the info returned by the rest api to create the second linked record.
Or, you could have an Airtable automation create the second linked record whenever a record is created in the first table.
My bot uses the following code to create the record when the user joins my server.
Blockquote
if (checkdb.rows.length == 0){
let memberadd = await lib.airtable.query[’@1.0.0’].insert({
table: Discord
,
fieldsets: t
{
‘Username’: ${event.user.username}
,
‘Nick’: ${event.nick}
,
‘User_ID’: ${event.user.id}
,
‘Discriminator’: ${event.user.discriminator}
,
‘Joined’: ${event.joined_at}
}
],
typecast: false
});
}
Username and UserID are both shared with the other table.
What should I do to make the other table actually update with the shared data? I haven’t done this with airtable before, so please treat me like I’m completely stupid and walk me though it.
My bot uses the following code to create the record when the user joins my server.
Blockquote
if (checkdb.rows.length == 0){
let memberadd = await lib.airtable.query[’@1.0.0’].insert({
table: Discord
,
fieldsets: t
{
‘Username’: ${event.user.username}
,
‘Nick’: ${event.nick}
,
‘User_ID’: ${event.user.id}
,
‘Discriminator’: ${event.user.discriminator}
,
‘Joined’: ${event.joined_at}
}
],
typecast: false
});
}
Username and UserID are both shared with the other table.
What should I do to make the other table actually update with the shared data? I haven’t done this with airtable before, so please treat me like I’m completely stupid and walk me though it.
I’m not familiar with the platform that you are using to create the Airtable records.
However, in general you would create the second record in the same way, only you would provide the other table and the fieldset would have a different set of fields that includes the linked record field. The value of the linked record field would be based on the record id returned when you created the first record. You may need to play around with the exact format (e.g. array versus string). I don’t use the REST API that often and don’t have those formats memorized.