Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Airtable Script to update a linked field with a string

Topic Labels: Scripting
295 3
cancel
Showing results for 
Search instead for 
Did you mean: 

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

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}'