Writing a File to the Local File SystemLast Updated: 08/11/2016 Introduced in Verision: 2.0
The Create Text File component saves a plain text file to the local file system.
Add it to a flow in the Flow Designer. In the Toolbox panel, under the category Integration > File, drag a Create Text File component to the workspace.
Our example flow will display a form with two text fields: File Name and File Description. When this form is submitted, our flow will create a file with the name given in the field File Name which contains the text in the File Description field. Our example assumes that this form has already been created and saved in our project folder with the name Create File Form. The form simply contains a text box for file name, a text block for the description, and a button.
Create a new flow in a Designer Folder by clicking the Create Flow button.
In the resulting pop-up, name the flow “Flow for creating file” and click OK.
In the Flow Designer, add the Create Text File component on the workspace. It is in the Toolbox panel, under the category Integration > File.
Drag the Create File Form also into the workspace. It can be found in the Toolbox panel, under the category Forms [Interaction] > [Current Folder].
Next, connect the outcomes of our flow. From the Start step to Create File Form, we will connect the Done outcome. From Create File Form to Create Text File 1, connect the OK outcome. From Create Text File 1 to the End step, connect the Done outcome.
To create a file, Create Text File 1 must be configured with a valid file name and contents. Because we want these values to come from the form, it is necessary to map the outputs of Create File Form to the required inputs of Create Text File 1. We will do this in the Mapping Editor, which can be opened by selecting Create Text File 1 and, in the Properties panel, clicking the link Show Mapping Editor.
The form field containing our new file’s name is represented by the output string FormInteractionForm_Data. Map it to the filename input by dragging its anchor to the filename heading and dropping it there.
Note that in Decisions version 3.5 and above, you’ll need to click on Test Flow to access the Debugger.
By default, new files are created in the default directory – C:\Program Files\Decisions\Decisions Services Manager.
To create the text file in a different location, we could explore the components listed under the Integration heading, or even add the document to a process folder.