1

how to export a file attachment

hello,

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.

4 replies

null
    • Jorg
    • 4 yrs ago
    • Reported - view

    Hi Peter, 

    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

    • Antonello_Stabile_71
    • 1 yr ago
    • Reported - view

    Novità per questa funzione

    • Walcher_Messebau
    • 1 yr ago
    • Reported - view

    To create a button in Ninox that exports a PDF file created by the PrintAndSaveRecord function 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 pdfData retrieves the PDF data using the PrintAndSaveRecord function. You should replace 'template_name' with the name of the report template that you want to use.

    The fileName variable specifies the desired name of the PDF file, and the fileUrl variable 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.

    The file variable 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 ImportFile command in the script of the sendmail button to attach the PDF file to the email message.

    • CISOFT_Sarl
    • 1 mth ago
    • Reported - view

    Hello,

    Nice topic, but where you find the functions ? : HTTP.file() and HTTP.upload()

Content aside

  • 1 Likes
  • 1 mth agoLast active
  • 4Replies
  • 1489Views
  • 4 Following