Help

Linking Multiple Records via Automation

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

Hello,

I want to be able to import transactions from Quickbooks, and link those transactions to a Client record from another table (Clients) in the base (relational).

The first issue that I ran into was having an automation update multiple records at once. It seems the solution to this is a script.

I modified one that seemed popular here to the following:

let config = input.config()
let records = config.QBRecords //.step2Records must match the Name field of the input field.
let table = base.getTable("Quickbooks 7-14-22 YTD"); // Replace with your table name.
for (let record of records) {
    await table.updateRecordAsync(record, {
      "Client": [{id: config.clientRecord}]
    })
}

However, it’s throwing an error: “Error: Field “fldOyEuNcD7vGj42h” cannot accept the provided value.
at main on line 5”

Can anyone help with this? I have a feeling it’s something dumb… but I can’t seem to fix it.

Thank you in advance.

Script:
Screen Shot 2022-07-21 at 4.14.04 PM

Automation:
Screen Shot 2022-07-21 at 4.16.39 PM

Quickbooks table:
Screen Shot 2022-07-21 at 4.17.12 PM

1 Solution

Accepted Solutions

The “list of record ids” is an array, even if its just one value. You need to adjust your script to handle the array.

"Client": config.clientRecord.map(x => ({id: x}))

^ that should do it. It takes each record ID from the array and formats it the way airtable needs it (an object with a single key-value pair).

See Solution in Thread

2 Replies 2

The “list of record ids” is an array, even if its just one value. You need to adjust your script to handle the array.

"Client": config.clientRecord.map(x => ({id: x}))

^ that should do it. It takes each record ID from the array and formats it the way airtable needs it (an object with a single key-value pair).

You’re amazing… this worked perfectly. Thank you!