Skip to main content
Version: 1.28 (Current)

Send Plain Text as File Download

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens

Sends text to the browser as a file, for example a CSV, TXT, HTML or XML file. The text is built from tokens when the action runs. Nothing is saved on the server.

It works in Forms and Listings. It ends the action list, so put it last.

Typical Use Cases​

  • Let users download a CSV export built with Create CSV from List
  • Download a text or XML file generated from form values
  • Give users a small HTML or text report they can save

Don't use it to​

Action NameDescription
Create CSV from ListBuilds CSV text from a list, which this action can send.
Send File for DownloadSends an existing portal file to the user.
Redirect to URLSends the user to a URL, for example a file's download link.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
File nameThe name of the file, for example Orders-[DateTime:Now|yyyyMMdd]. If it's empty, the current page name is used. If it has an extension, for example orders.csv, the extension isn't added again.Yesempty stringNo
File TypeThe file type: csv, html, txt, xml or xsl. It sets the content type sent to the browser, and it's added to File name as the extension if the name doesn't have one.YesemptyNo
HeadersExtra HTTP headers to send with the file. Each row has a Name and a Value, for example Cache-Control and no-store. Content-Type and Content-Disposition are ignored.YesemptyNo
Force downloadWhen on, the browser downloads the file. When off, the browser may open the file in the current tab instead, if it can show that type.NofalseNo
File ContentThe text of the file, for example [OrdersCsv].Yesempty stringNo

How the download works​

  1. The action sends a small hidden form to the browser and ends the action list. Any actions after it don't run. In Forms, the submit button is enabled again.
  2. The browser posts the form, with the file content, to the site.
  3. The site sends the content back as a file, encoded as UTF-8, with the chosen file name and content type.

With Force download off, the file is sent inline. For types the browser can show, like text or HTML, the browser opens it in the current tab and leaves the page.

Considerations​

  • Set a File Type. The content type always comes from File Type, even when File name has its own extension. Without one, the file is sent as application/octet-stream and has no extension unless File name has one.
  • Turn on Force download unless you want the browser to open the file.
  • The content goes through the browser. The text is sent to the browser and posted back, so very large content can hit the site's request size limit.
  • The user needs view permission on the module that runs the action.
  • Header values can't contain double quotes, since the headers are sent as JSON after tokens are replaced.
  • No byte order mark (BOM) is added. Some versions of Excel may show accented characters incorrectly in a CSV without one.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Download orders as a CSV file​

The first action writes OrdersList as CSV text to the OrdersCsv token. The second action sends that text to the browser as Orders-<date>.csv.

[
{
"Title": "Create CSV from List",
"ActionType": "CSV",
"Description": "Build the CSV text",
"Parameters": {
"EntityName": "OrdersList",
"IncludeAllFields": true,
"RemoveFieldNames": false,
"FieldSeparator": {
"Expression": "",
"Value": "comma",
"IsExpression": false,
"Parameters": {}
},
"StorageLocation": {
"Expression": "",
"Value": "Memory",
"IsExpression": false,
"Parameters": {}
},
"OutputTokenName": "OrdersCsv"
}
},
{
"Title": "Send Plain Text as File Download",
"ActionType": "DowndloadFile",
"Description": "Download the CSV",
"Parameters": {
"FileName": "Orders-[DateTime:Now|yyyyMMdd]",
"FileTypeId": {
"Expression": "",
"Value": "csv",
"IsExpression": false,
"Parameters": {}
},
"Headers": [],
"FileCheck": true,
"DowndloadFile": "[OrdersCsv]"
}
}
]

2. Download a text summary of a form​

This action downloads a text file with the values of a contact form, named after the contact.

{
"Title": "Send Plain Text as File Download",
"ActionType": "DowndloadFile",
"Description": "Download contact summary",
"Parameters": {
"FileName": "Contact-[LastName].txt",
"FileTypeId": {
"Expression": "",
"Value": "txt",
"IsExpression": false,
"Parameters": {}
},
"Headers": [
{
"name": "Cache-Control",
"value": "no-store"
}
],
"FileCheck": true,
"DowndloadFile": "Name: [FirstName] [LastName]\nEmail: [Email]\nPhone: [Phone]"
}
}

Revised 09/27/2026