Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Script: On update, how to get only the updated record?

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

I’m creating an automation to run when a record is updated like this:

"airtable

In the script, how can I get the record that was updated or its ID? So I can target only it. The example I’ve found select all records:

// Update all the records
let result = await table.selectRecordsAsync();
for (let record of result.records) {
    console.log(record)
}
1 Solution

Accepted Solutions

You can get the record id of the triggering record and any of its field values as input variables using the automations version of input.config. There is a link to an example in the automations script editor.

See Solution in Thread

2 Replies 2

You can get the record id of the triggering record and any of its field values as input variables using the automations version of input.config. There is a link to an example in the automations script editor.

Is there a way to update the record from my script, after I’ve done the processing? I’m trying something like this:

Updated: I think I found the solution from the error message. I can pass in a recordId; I thought it had to be record, which I didn’t have.

await table.updateRecordAsync(config.recordId, {
   theProp: theNewData,
});