Hi everyone – Mendix newbe here. I’m trying to have the Download File action display a FileDocument that was created or cloned, but get an error in the browser: An error occurred while executing On click at DataGathering.Page0_Documents.actionButton1: Did not expect an argument to be undefined Error: An error occurred while executing On click at DataGathering.Page0_Documents.actionButton1: Did not expect an argument to be undefined at http://localhost:8080/mxclientsystem/mxui/mxui.js?637103706428314049:73:302113 at ve (http://localhost:8080/mxclientsystem/mxui/mxui.js?637103706428314049:35:8729) at r (http://localhost:8080/mxclientsystem/mxui/mxui.js?637103706428314049:35:8625) at m (http://localhost:8080/mxclientsystem/mxui/mxui.js?637103706428314049:40:140472) I start with a PDF file that I uploaded using the Documents upload from the Forms starter application, but for testing I added a button that calls a microflow so I can use the DataEntry/Supporting documents. I then get the PDF from a loop that iterates over the documentList. If I send the PDF (iterator from loop) directly to a Download File action, it works fine. If I use the “Create File Document” to create a new document action and then the “Duplicate file Document” to copy the PDF and send that to Download File, i get the error above. I also tried calling the Commit action before sending to Download File to no avail. If I send it to a Java action and just return it right back out from the return value, it works fine when downloaded with the Download File action. Similar to the Create File Document (using essentially the same logic), if in the java action I clone/copy it using Core.storeFileDocumentContent, then return it and use it in the Download File action, I get the error above. My real goal is to Pre-fill an editable PDF file using PDFBox and download it. I don’t have any problems pre-fill the Editable PDF file just fine in the Java Action, but the problem is getting it out of the Java Action as a File Document. In running locally for troubleshooting I can take the original PDF, load it into a PDFBox PDDOcument, pre-fill it and save it as an outputstream, load it into an inputstream, and then the file system using System.IO.File inside the Java Action without any issue and the file is fine. The plan is to try and use Core.storeFileDocument to take the modifed pdf bytes and load it into a File Document, but Just getting a cloned File Document out of the Java action that I can use with Download File is proving to be problematic. I’m not sure what I can show that will help out. I can send sample java code for a particular part if it helps but maybe I’m missing a core concept because I can’t even get the results of the “Duplicate File Document” action to show. Thanks Mike H.
In Studio Pro in the view of the microflow there is a ‘share’-button. Click that and share the link here. Makes it easier for us to help you.
Tim van Steenbergen
Here are the microflows that I am trying to make work. I’m just dropping a button on the documents page from the Forms Starter App that calls one of them.