Writing a File to the Local File System

Last Updated: 05/02/2018 Introduced in Version: 2.0

The Create Text File component saves a plain text file to the local file system.

You can add in the flow by means of the Flow Designer. In the Toolbox panel, under the category Integration > All Integrations > File, drag a Create Text File component to the workspace.

 

Example

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 we provided in the field File Name. The data contained within the file will come from the File Description field. Our example requires that this form has already been created and saved in our project folder. The name of the form Create File Form. The form simply contains a Text Box for the file name, a Text Box Multi Line for the description, and a Button.

 

Create a new flow in a Designer Folder by clicking the Create Flow button. In the resulting popup, name the flow Flow for creating file and click OK.

Add the Create Text File component in the workspace.

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.

To create a file, the Create Text File must be configured with a valid file name and contents. Since 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. We will do this in the Mapping Editor. This can be opened by selecting Create Text File and, in the Properties panel, clicking the link Edit Input Mappings.

 

The form field containing our new file’s name is represented by the output string File Name. Map it to the file Name input by dragging our output anchor into the input of file Name. The form field containing our new file’s contents is represented by the output string File Description. Map it to the data input by dragging the File Description output to the data input.

Click OK.

Click the Debug Flow link at the top of the Flow Designer.

Once the form generates in the debugger, enter a file name and description and then, click OK.
 

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.

fileinsystem

Additional Resources