Help

Re: Updating Multiple Records with Script/Automation

2221 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Wendy_French
5 - Automation Enthusiast
5 - Automation Enthusiast

I have inventory that is permanent and gets checked in and out. I have created a form that includes the status change, the inventory ID, and the name of the person who checked it out. We often check out 10+ items at one time, making them all part of 1 transaction.

The form form has a multiple select option for choosing every item they are checking out. The form data goes to a transactions table that is linked to a parent table that shows UTD inventory of all of our items at any given time.

Essentially, the process would be:

form submission → record created in transaction table → update status of selected items in the parent table

Here is the current automation I’ve been trying to work with, where it will run successfully:

image

And how it is running unsuccessfully:

5.17.22 (2)

I’m aware that the issue directly comes from AT not reading both Record IDs to update.

I do not have access to apps, only to scripts. Please help!

25 Replies 25

Woohoo! It works! Thank you so much!

Hey :slightly_smiling_face:
Thank you for this script you’ve put out that matches perfectly one on my need. However, I have this error “Error: Request parameters failed validation.”, right on the while, any idea what could it be ?

while (updates.length > 0) {
    await table.updateRecordsAsync(updates.slice(0, 50));
    updates = updates.slice(50);
    console.log(updates)
}

I checked my table permission, profile permission, it doesn’t seem to be that :frowning:
Thanks !

Hi @Floriane_Hibelot, could you invite me to your base so that I can try to troubleshoot it from there please? Thanks

Hi, thanks for the quick reply ! I unfortunately can’t invite you but here is the automation
image
image

My code : `
let inputConfig = input.config()
let quoteStatus = inputConfig.quote_status
let requests = inputConfig.query

let statusToUpdateTo;
switch (quoteStatus) {
case “accepted”:
statusToUpdateTo = “To be ordered”
break;
default:
statusToUpdateTo = “Error”
}

// let updates = new Array
let updates = requests.map(x => ({
id: x,
fields: {
“Status update”: {name: statusToUpdateTo}
}
}))

console.log(updates)
let table = base.getTable(‘Requests’)
console.log(table);

while (updates.length > 0) {
await table.updateRecordsAsync(updates.slice(0, 50));
updates = updates.slice(50);
}

console.log(updates)`

I am really keen to explore some option if you have any idea, I already checked internet so much :grinning_face_with_smiling_eyes:

When updating a record, you need to use the internal record ID that starts with rec followed by 14 alphanumeric characters.

It looks like you are using a number from the input variable instead of the record ID. Try changing the input variable to use the record ID instead of the name of the linked variable.

Floriane_Hibelo
5 - Automation Enthusiast
5 - Automation Enthusiast

That was it ! Can’t believe I didn’t think of that, thank you soooooo so much !