how to export a file attachment
i want to create a button to export a pdf file, created by printandsaverecord, in a external(https://www.....) location.
This in order to use this file in the mailing to the client in another table.
I use already an external file in the sendmail through the importfile command in the scripting.
At the moment PDF attachments can only be exported manually.
We have already planned also other solutions.
Thank you for your patience.
Kind regards, Jörg
Novità per questa funzione
To create a button in Ninox that exports a PDF file created by the
PrintAndSaveRecordfunction to an external location, you can use the following formula:
let pdfData := PrintAndSaveRecord('template_name', PDF); let fileName := 'file_name.pdf'; //replace 'file_name' with the desired file name let fileUrl := 'https://www.example.com/folder/' + fileName; //replace 'https://www.example.com/folder/' with the desired external location let file := HTTP.file(fileUrl); HTTP.upload(file, pdfData, 'application/pdf', fileName);
In this formula, the variable
pdfDataretrieves the PDF data using the
PrintAndSaveRecordfunction. You should replace
'template_name'with the name of the report template that you want to use.
fileNamevariable specifies the desired name of the PDF file, and the
fileUrlvariable specifies the external location where the PDF file will be uploaded. You should replace
'https://www.example.com/folder/'with the URL of the external location where you want to store the PDF file.
filevariable creates a file object with the specified file URL, and the
HTTP.upload()function uploads the PDF data to the external location using the file object, the PDF data, the MIME type of the PDF file, and the file name.
Note that you will need to have write access to the external location in order to upload the PDF file. Also, you should replace the file URL with the actual URL of the external location where you want to store the PDF file.
Once the PDF file is uploaded to the external location, you can use the
ImportFilecommand in the script of the sendmail button to attach the PDF file to the email message.
- 6 mths agoLast active