Help

Using a variable for field name in updateRecordAsync method

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

Hi there!

I’m not a developer but I trying to write a script.
Please tell me if is possible to use a variable to define the field name inside updateRecordAsync method.

await table.updateRecordAsync(record, {"Phone": value})

the method accepts variables for “record” and for field “value”

but I want to use a variable for “Phone” (without quote marks) like the example below:

let fieldName = "Phone";
await table.updateRecordAsync(record, {fieldName: value});

I want to let users set up fieldName using input.config

Please help. :pray:

1 Solution

Accepted Solutions
Alexey_Gusev
12 - Earth
12 - Earth

Hi,

use such syntax for that:
await table.updateRecordAsync(record, {[fieldName]: value});

See Solution in Thread

2 Replies 2
Alexey_Gusev
12 - Earth
12 - Earth

Hi,

use such syntax for that:
await table.updateRecordAsync(record, {[fieldName]: value});

Thanks, Alexey! I appreciate it