Airtable Script to update a linked field with a string

Topic Labels: Scripting
1350 3
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

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 3
6 - Interface Innovator
6 - Interface Innovator

What type of field is Contact Name

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

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