Help

Re: PDF Download Issue / Attachment URL Expiry Notice

1253 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Francoloco23
5 - Automation Enthusiast
5 - Automation Enthusiast

Good day Airtable team,

For Airtable and Softr, I have an issue when it comes to reports not downloaded as PDF automatically in Softr. So these are the following steps I did, Our internal team uploads several reports in the Softr page. Using the file name ortiz_fritzgerald_berame_qualfon_cebu_negrec_0524_144p9rbgw.pdf Once uploaded, there is a script developed and placed in Airtable (please see below) wherein the attachments uploaded are readable in the backend. Once an attachment has been extracted and read, it will automatically go through another table in Airtable for matching with the name endorsed by client. Once matched, the report will be viewed already by the client via Softr. I believe that there might be an error when it comes to the script developed as I observed when I checked Step 1 in Softr, the reports are downloadable via pdf.

The script run:

const { record_id } = input.config();

const sourceTable = base.getTable("Bulk Upload");

const destinationTable = base.getTable("Bulk Upload Extract");

const selectedField = sourceTable.getField("Attachments");

const nameField = destinationTable.getField("File name");

const attachmentField = destinationTable.getField("Attachments");

let record = await sourceTable.selectRecordAsync(record_id);

let recordAttachments = record.getCellValue(selectedField);

if (recordAttachments) { let newRecords = recordAttachments.map(attachment => ({ fields: { [nameField.id]: attachment.filename, [attachmentField.id]: [{ url: attachment.url }] } })); while (newRecords.length > 0) { await destinationTable.createRecordsAsync(newRecords.slice(0, 50)); newRecords = newRecords.slice(50); } }

When I run the script, the file name will result to FJhTZnIeDLVei4FkFRxKP7akDL9RW1IYZj4leisSlLA and the attachment not automatically downloaded as PDF. But as I discovered, my problem I believe is also affected by this announcement: On November 8, 2022, Airtable improved the security of our attachment URLs by incorporating an expiring links functionality across our product surface areas. You can read more about this behavior here. This update included changes to the way all versions of the Blocks SDK handles attachments. If you use the following SDK methods to obtain attachment URLs, please keep in mind that the update impacted the following: getCellValue getCellValueAsString getAttachmentClientUrlFromCellValueUrl

 

Is there a way for me to edit this code wherein my ultimate goal is from another table in Airtable, the attachment can be automatically downloaded in PDF? This could affect almost all of my clients.

1 Reply 1
Francoloco23
5 - Automation Enthusiast
5 - Automation Enthusiast

Good day Airtable Community,

Any update on my inquiry here?

Thanks