How do I simply delete a System.FileDocument object shortly after downloading it?
I am using the Word Exporter module in my 8.14.1 Mendix project to generate Office Word documents from a predefined template. After generating the document, I use the ‘Download File’ action to download it to the client. Because there may be many of these document generations, I do not want to store the files in the database. But when I add a ‘Delete Object’ action for the new document after the download action, I get the following error: An error occurred while executing an action of DGAFAModule.Word_Document_Generation.actionButton1: Did not expect an argument to be undefined Error: An error occurred while executing an action of DGAFAModule.Word_Document_Generation.actionButton1: Did not expect an argument to be undefined at http://localhost:8082/mxclientsystem/mxui/mxui.js?637558866293661256:79:301694 at _e (http://localhost:8082/mxclientsystem/mxui/mxui.js?637558866293661256:34:6720) at r (http://localhost:8082/mxclientsystem/mxui/mxui.js?637558866293661256:34:6616) at d (http://localhost:8082/mxclientsystem/mxui/mxui.js?637558866293661256:39:145114) How can I delete this System.FileDocument object shortly after downloading it?
Have you tried setting the DeleteAfterDownload attribute to “true” on the System.FileDocument generalisation you’re using? It should delete automatically after download if you have this set.
Hope this helps.
The error probably raises from the fact that the button is trying to start a microflow with an empty object.
In general, when you do not commit a file that is being downloaded by a user it will not be stored in the database. You can send the file to a user and not worry about your database becoming clogged. You don't necessarily need to delete the object either; it will be deleted when the session has ended.