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

Need help passing a variable for the field name with updateRecordAsync

Topic Labels: Scripting extentions
Solved
Jump to Solution
398 2
cancel
Showing results for 
Search instead for 
Did you mean: 

This is killing me. It’s literally the last speedbump in my first Airtable script:

I have this command:

await email.updateRecordAsync(dateArray[i][0],{‘ActualFieldName’ : linkID});

It works! But THIS…

await email.updateRecordAsync(dateArray[i][0],{fieldVar : linkID});

DOESN’T WORK. Even with the single-quotes gone, the system is still parsing my defined and assigned fieldVar as the string “fieldVar”.

It’s maddening. Any ideas?

1 Solution

Accepted Solutions

Wrap square braces around the variable that contains the field name.

await email.updateRecordAsync(dateArray[i][0],{[fieldVar] : linkID});

See Solution in Thread

2 Replies 2

Wrap square braces around the variable that contains the field name.

await email.updateRecordAsync(dateArray[i][0],{[fieldVar] : linkID});