Skip to main content

Airtable Script to update a linked field with a string

  • December 30, 2022
  • 3 replies
  • 36 views

Forum|alt.badge.img+2

Can you help.

I need to replace a linked field with a string - both in the same table. Here's my code:

 

The problem is on line 23.

 
If I run it as the following it works fine. However "YSW CC2" is a text field.
23        await mainTable.updateRecordAsync(record, {"YSW CC2": returnValue
 
If I run it as the following it comes up with the error below. "Contact Name " is a linked field.
23       await mainTable.updateRecordAsync(record, {"Contact Name": returnValue

 

If I try the format as suggested by @Karlstens "Updating record Linked Field with a string array" I still get the error.

23    await mainTable.updateRecordAsync(record, {"Contact Name": [{id:'${returnvalue}'}]
 
 
Can anyone help. I can't work out what I'm doing wrong.
 
Much appreciated 🙂

3 replies

Matthew_Carrano
Forum|alt.badge.img+14
  • Known Participant
  • 34 replies
  • December 30, 2022

What type of field is Contact Name


Forum|alt.badge.img+2
  • Author
  • New Participant
  • 1 reply
  • December 30, 2022

What type of field is Contact Name


Contact Name    is a linked field. It's a String format


Matthew_Carrano
Forum|alt.badge.img+14
  • Known Participant
  • 34 replies
  • December 30, 2022

Contact Name    is a linked field. It's a String format


So the variable returnValue needs to be a record ID and you also just need to type returnValue not '${returnValue}'. To get the ID, just do rangeRecord.id

Also for future refence, the correct notation is  `${variableName}` not '${variableName}'