Jul 21, 2022 02:21 PM
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:
Solved! Go to Solution.
Jul 21, 2022 03:28 PM
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).
Jul 21, 2022 03:28 PM
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).
Jul 22, 2022 08:12 AM
You’re amazing… this worked perfectly. Thank you!