Skip to main content
Solved

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

  • February 27, 2021
  • 3 replies
  • 105 views

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

"

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)
}

Best answer by kuovonne

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.

3 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • February 27, 2021

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.


  • Author
  • New Participant
  • February 27, 2021

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,
});

Forum|alt.badge.img
  • New Participant
  • June 5, 2023

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,
});

Hello Isle,

I am struggling with exact same problem. Can you explain a little bit more how did you come up with a solution? I am new to JS and I was not able to make this line of code work.

Thank you