Need help passing a variable for the field name with updateRecordAsync

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?

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

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

I love you.

That worked.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.