Help

Error when creating script within automation to update multiple rows.

Topic Labels: Scripting
1621 6
cancel
Showing results for 
Search instead for 
Did you mean: 
max2
4 - Data Explorer
4 - Data Explorer

hey!  trying to get this script to run, and I cannot seem get it right.  Any help would be appreciated!

Scenario:  I'm trying to update a list of Records as a step in an automation.  I have my automation to receive both the row for which the values will be inherited from, and the list of records in which to deposit the values.  

I've modified what seems to be a popular script, below:

Script 

 

 

 

 

let config = input.config();
let StackerEmail = config.StackerEmail
let ALink = config.ALink
let records = config.RowIDs
let table = base.getTable("Projects");

for (let record of records) {
    await table.updateRecordAsync(record, {
    "[For Stacker] A Email": [{StackerEmail}],
    "A Link": [{ALink}],
    })
}

 

 

 

 

The error I receive:

 

 

 

 

ERROR
Error: Field "fldLpHsJuxicnS2eZ" cannot accept the provided value.
    at main on line 8

 

 

 

 


input (With examples & field types)

RowIDsrec7eF4Q0oCnT3Yfi, rec9rkbTs8QjYvC5Y, recC3F48nlqUuu5KL, ect. (Type: List of 'Airtable record ID')

StackerEmailtest@test.com (type: Email)

ALink | Max Eval 2 (Type: Linked Record Name)

 

Columns being edited (Will receive the values):

"[For Stacker] A Email"

"A Link"

 

As a note, both the input, and the desired output rows are within the same table.

Thank You!

6 Replies 6

First, could you update the "ALink" input config to be the linked record ID instead of name?

Then, try modifying this bit:

 "[For Stacker] A Email": [{StackerEmail}],
"A Link": [{ALink}], 

To:

 "[For Stacker] A Email": StackerEmail,
"A Link": ALink, 

If this doesn't work, if you could provide a link to an example base with the script set up I could help you take a look at it
 

catz
5 - Automation Enthusiast
5 - Automation Enthusiast

are both of the column types you're trying to updated, links to multiple records?

if so, the object to update it with should be an array of ids, for ex: 

await table.updateRecordAsync(record, {
    "[For Stacker] A Email": [{id: StackerEmail}],
    "A Link": [{id: ALink}],
    })

https://airtable.com/developers/scripting/api/cell_values#multiple-record-links

hope that helps! 

Thanks for this!  Unfortunately, this did not help for me...  For more clarity - I have these configured so that plain text input will kick off another automation to make these work.. essentially, what I really just need is to input the plan text values of StackerEmail & Alink.

for more context, I realized I can give more insight into the debugger:

 

max2_0-1675394239856.png

 

So all of the columns to be updated are their own standalone records.  I have other automations that are adding a reference ID to another column, and that's how I am identifying the columns themselves in prior steps.

 

Essentially, I just need the string values into these fields.  Even if I cannot get a field into ALink -- the Stacker email field is most crucial, and still it will not go.

FYI: I believe I found a solution.  essentially I abandoned using the alink field, and I abandoned the {[]} on the second part 

"[For Stacker] A Email": StackerEmail,

 Thank you for the help!!

FYI: I believe I found a solution.  essentially I abandoned using the alink field, and I abandoned the {[]} on the second part 

 

"[For Stacker] A Email": StackerEmail,

 

 Thank you for the help!!