Comment on page
To import a file from a URL and save it as an attachment of a record
With this function, you can import a file and attach it to a record or insert it in an image field.
The file can be pulled/retrieved from an external URL. But with
printAndSaveRecord()you can also attach an extra created file.
importFile(nid, string, string)
importFile(nid, link, string)
importFile(record, link, fileName) To import a file from a given URL string and save it as an attachment of a record.
importFile(this, "https://ninox.com/example.jpg", "Image.jpg")
Result: The file provided via the given link is attached to the current record with the name Image.jpg.
Invoice := importFile(this, printAndSaveRecord(this, "Invoice layout"))
Result: Prints the current record in the Invoice layout to a PDF and saves the file in the Invoice image field.