Create a FileDocument object within a microflow

I am trying to create a FileDocument object within a microflow. I have a text file that I want to specify within the microflow and have an object created from it. The goal is to be able to use the (S)FTP module to send that file to a server. When I use the create an Object activity inside of a microflow and I select the FileDocument entity the only attributes that are available to set are the Name and the DeleteAfterDownload attributes. Is it possible to specify a file path and a file name? I know a page can be created with a DataView for the FileDocument entity where you can use a file picker to select the file, however I am trying to automate the process and would like to select the file through a microflow by providing the location and name without any manual user input. Any advice is welcomed or if there is a better way to accomplish this please let me know.
2 answers

You can only set the attributes that aren't connected to the binary data of the file. However using the community commons function texttofile you would be able to save your test contents to your newly created FileDocument object.

On creation of that FileDocument object, you can give it a name. And then commit it to save the file to disk (if the community commons function doesn't already take care of that).

Afterwards, you can use the (S)FTP module to send it to the server of choice.


The FileDocuement/Name is the filename of that document. So when creating a filedocument from within Mendix (see the documentation: you can use this document to pass to the SFTP module. There you can store the filedocument on a SFTP server. In the SFTP server configuration you can define the path where to store the document on the server, so you can choose different directories for instance for different type of documents.

Otherwise the path does not make sense. A filedocument either gets downloaded or is shown in the browser (depending on the setting). Hope this helps.