Help

Re: Airtable Script to update a linked field with a string

1818 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Rob_Dixon
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:

 
Rob_Dixon_0-1672412247992.png

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
Rob_Dixon_1-1672412553783.png

 

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
Matthew_Carrano
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 rangeRecord.id

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