Skip to main content

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:


Automation:


Quickbooks table:

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


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!


Reply