Hi everyone, I have a bunch of records and have used the QR Code Generator extension to generate a QR Code and save it to an attachment field. The problem with this is that each QR code has the same filename (as there’s no option to rename the file), this makes it very confusing when downloading them all.
I have come across a script here : Automate changing the file name of an attachment
// Setup
let config = input.config()
let table = base.getTable(“ :amphora: CONSIGNED ITEMS”)
let query = await table.selectRecordsAsync()
let record = query.getRecord(config.recordID)// Collect record data
let newPrefix = record.getCellValue(“AuctionLotNumber”)
let files = record.getCellValue(“Bidsquare Cloud QR”)// Get the extension and add it to the new name
let newFiles =
for (let file of files) {
let parts = file.filename.split(“.”)
let ext = parts[parts.length - 1]
let fileNumber = “0” + (files.indexOf(file) + 1)
let newName =${newPrefix}-${fileNumber}.${ext}
newFiles.push({url: file.url, filename: newName})
}// Reattach the item with the new filename
await table.updateRecordAsync(record, {
“Renamed Bidsquare Cloud QR”: newFiles
})
However, I’m struggling to implement that solution (and couldn’t figure out how to restart or reopen that other topic). I am getting errors at:
let config = input.config()
let query = await table.selectRecordsAsync()
- selectRecordsAsync is strikethrough
What I am trying to do is rename each QR Code using information from another field (called ‘AuctionLotNumber’ in the same Table ( :amphora: CONSIGNED ITEMS).
Thanks in advance for the help!

