Actions

generate-file

5min

This action generates files such as PDFs, CSVs, or text files. It accepts content to be written to the file, along with an optional encoding parameter. Once generated, the file's URI is returned and included in the action instance output.

Configuration options



Core structure



content

The content to be included in the file. You can use datasources, expressions, or text.

fileName

Give the file a name, this name is used as the local file name, and is referenced as part of the uri, which can be accessed via the action's instance output ([email protected]). The action output uri is only available in the sequential action-list. The file extension must be included in the fileName, e.g., Application.txt.

instanceId

Provide a unique identifier for the action, which provides access to the action's state.

title

Provide the action button with a title, for example, Create Application.

Other options



encoding

The encoding of file utf8. The default is utf8.

Considerations

  • You can reference the local file using the action's output uri in other actions or components, [email protected]. For example, generate the file then share the file. The outputs is only supported in a sequential action-list, meaning within the context of that action. To use the outputs in components, either use the saved value or persist it to state.
  • Depending on where you save and use the saved file, you might need to use conversions.
  • The file extension must be included in the fileName, e.g., FormA.docx.

Examples and code snippets 

Generate and share the file

Generate text file
Generate text file


In this example, an action list contains two actions: the first generates a text file, the second shares the file via a sharing app on the device.

action-generate-file.jigx




Updated 26 Feb 2025
Doc contributor
Did this page help you?