Help

Need help passing a variable for the field name with updateRecordAsync

Topic Labels: Scripting extentions
Solved
Jump to Solution
1429 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Joshua_Vogel1
5 - Automation Enthusiast
5 - Automation Enthusiast

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
Justin_Barrett
18 - Pluto
18 - Pluto

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
Justin_Barrett
18 - Pluto
18 - Pluto

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

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

I love you.

That worked.