Help

Re: Can’t Download Multiples File to PDF using Softr

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

Good day to all,

I am currently using both Airtable and Softr for my endorsement platform. Here, our internal team uploads more than 2 pdf reports via Softr with a sample file name convention: trinidad_franco_luis_cruz_CIBI_negrec_)511_h7tezeubi.pdf

However, once client has downloaded the PDF file in Softr, this is what will appear. The client can’t download the file in PDF.

Softr Error 2.PNG

Then these are the steps currently being done: 

  1. Our internal team uploads several reports in the Softr page.
  2. Once uploaded, there is a script developed and placed in Airtable (please see screenshot) wherein the attachments uploaded are readable in the backend.
  3. 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.
  4. 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.

Here is the code developed for Step 2:

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);
    }
}

Thanks

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

Good afternoon community,

I just want to seek your advice on this problem I am experiencing with regards to the pdf being uploaded via Softr, then on the backend in Airtable, a code is run to read every attachment uploaded, once it has been extracted, the attachment when downloaded is not viewed as a PDF.

What can be added in the script to read the file name extension with pdf through my base?

Thanks