Save the date! Join us on October 16 for our Product Ops launch event. Register here.
May 17, 2022 08:32 AM
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:
And how it is running unsuccessfully:
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!
May 21, 2022 10:45 AM
Woohoo! It works! Thank you so much!
Sep 07, 2022 02:20 AM
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 !
Sep 07, 2022 02:34 AM
Hi @Floriane_Hibelot, could you invite me to your base so that I can try to troubleshoot it from there please? Thanks
Sep 07, 2022 02:56 AM
Hi, thanks for the quick reply ! I unfortunately can’t invite you but here is the automation
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:
Sep 07, 2022 04:46 AM
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.
Sep 07, 2022 06:26 AM
That was it ! Can’t believe I didn’t think of that, thank you soooooo so much !