Files
In the admin: Workflows › a Workflow › a step
The Files steps work with TotalBase's Files: read one, store a new one, turn a CSV or JSON file into data, or data into CSV or JSON.
| Step | Does | Result, as {{step.data}} |
|---|---|---|
| Read file | Read an existing file | { name, filename, mimeType, size, content }, the content in base64 |
| Create file | Store content as a new file | { asset, name, mimeType, size } |
| Parse CSV / JSON | Turn a file's content into data | the parsed data |
| Generate CSV / JSON | Turn data into CSV or JSON text | { format, content } |
Read file
| Field | |
|---|---|
| File | Required. A file picked with Browse, or its id from another step: {{create_file.data.asset}} |
The content comes back in base64, ready for a Create file with Encoding Base64, or for an HTTP request body.
Create file
| Field | |
|---|---|
| Name | Required. The file's name, with {{…}} |
| Content type | The file's type, text/plain by default |
| Folder | Where the file is stored. None: the root |
| Encoding | Text, stored as UTF-8, or Base64, for binary content from another step, such as a PDF |
| Content | Required. Text, or base64 when Encoding says so, with {{…}} |
The file goes through the Files module like an upload: its type and size rules apply, and the executor is recorded as who created it. The new file's id is {{step.data.asset}}, which a Send email step attaches or a Create records step stores in a column.
Order completed stores the PDF it generated:
| Field | Value |
|---|---|
| Name | {{start.data.number}}.pdf |
| Content type | application/pdf |
| Encoding | Base64 |
| Content | {{pdf.data.content}} |
Parse CSV / JSON
| Field | |
|---|---|
| File | Required. The file to read |
| Format | csv or json |
A JSON file becomes its value. A CSV file becomes a list of objects, one per line, keyed by the header row: standard CSV (RFC 4180), comma-separated, with a header row. Other delimiters aren't supported. A file that doesn't parse fails the step.
The list goes straight into a Create records step's Records ({{parse.data}}), or through a For each item when each row needs its own steps.
Generate CSV / JSON
| Field | |
|---|---|
| Format | csv or json |
| Data | The value to write. CSV takes a list of objects, a column per key; anything else gives an empty CSV |
It only produces text, in {{step.data.content}}; it stores nothing. Follow it with a Create file to keep the result, with Encoding Text.
Permissions
The steps act on files as the executor, under the same rules as the Files API (see Who can see a file):
| Step | Needs |
|---|---|
| Read file, Parse CSV / JSON | nothing for a public file; otherwise READ on files, within the executor's row filter |
| Create file | CREATE on files |
| Generate CSV / JSON | nothing: it touches no file |
A refusal fails the step with FILE_ACCESS_DENIED, checked before the content is read. An administrator executor, the Workflows system account included, has full access.
Keep binary content out of the history
A file's base64 content is part of a step's result, so a Detailed history would keep it in each step that carries it, up to the history size limit. Prefer passing a file's id between steps, and returning { "asset": "{{save_pdf.data.asset}}" } rather than the content itself.
Next steps
- Documents: generate the PDF to store.
- Communication: attach the stored file to an email.