Skip to main content
Solved

Script error linked record

  • October 31, 2024
  • 3 replies
  • 25 views

uitholland
Forum|alt.badge.img+4

Hi, 

I want to create a new record and link it with the right assets.

Creating the record goes wel, but linking the assets won't work.

I get this error. I am a bit new to airtable, maybe it is a beginner mistake.

Thanks in advance.

Greetings,
Robin

 

 

 

const inputData = input.config(); const { txt_name, txt_files } = inputData; // Specify the tables let postsTable = base.getTable('Social media posts'); let assetsTable = base.getTable('Assets'); // Create a new record in the 'Social media posts' table and capture the ID let newRecordId = await postsTable.createRecordAsync({ 'Naam': txt_name, }); // Update the record in 'Assets' where the ID matches txt_files, setting "Social media posts" field to the new record ID await assetsTable.updateRecordAsync(txt_files, { 'Social media posts': [{ id: newRecordId }], });

 

 

 

Best answer by TheTimeSavingCo

Could I check that you've set your input variable for the linked record to display as "ID"?

The linked records value is also an array, so you'd need to do `txt_files[0]` in your updateRecordAsync

3 replies

TheTimeSavingCo
Forum|alt.badge.img+31
  • Brainy
  • 6457 replies
  • Answer
  • November 1, 2024

Could I check that you've set your input variable for the linked record to display as "ID"?

The linked records value is also an array, so you'd need to do `txt_files[0]` in your updateRecordAsync


uitholland
Forum|alt.badge.img+4
  • Author
  • New Participant
  • 1 reply
  • November 1, 2024

Could I check that you've set your input variable for the linked record to display as "ID"?

The linked records value is also an array, so you'd need to do `txt_files[0]` in your updateRecordAsync


@TheTimeSavingCo 

Yes, it is...


TheTimeSavingCo
Forum|alt.badge.img+31

@TheTimeSavingCo 

Yes, it is...


Thanks!  Also just realized that your screenshot actually includes that detail, sorry about missing that

Did the array thing work?