Set Form File
Controlled node
Overview
The Set Form File node programmatically sets a file value within a form element that accepts file inputs. This node is essential for workflows that need to pre-populate file upload fields or programmatically attach files to form elements based on workflow logic (e.g., auto-attaching a generated document or a file selected from the library).
When executed, the node securely handles the file reference by creating a JWT-signed token (fileToken) that replaces the original file ID in the form data, ensuring secure transmission and storage within the form's runtime state.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Set | Event | Triggers the node to set the file in the target form element. | - |
| Page | Data (DropDown) | The display name of the page containing the target file input element. | - |
| Element | Data (DropDown) | The display name of the form element (file input) that will receive the file. | - |
| File | Data | A file object from the library containing at minimum an id field referencing the document to be set. | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the file has been successfully written to the form element's runtime data. |
Runtime Behavior
When the Set event is triggered, the node performs the following operations:
- Validation: Checks that the provided
fileinput is a valid object containing anidfield. If invalid, the node exits without firingDone. - Resolution: Looks up the internal page ID and element ID based on the provided display names.
- Security Tokenization: Creates a JWT-signed
fileTokencontaining the document ID and project ID, then constructs a new file value object where the originalidis replaced by this token. - Data Persistence: Writes the file data to the workflow's runtime form data storage at the path
formData/{pageId}/{elementId}.
The node modifies the file object structure for security purposes. The original id field is removed and replaced with a fileToken. If you need to access the file ID later in the workflow, capture it before passing the object to this node.
Example
A common use case is auto-populating a file upload field after generating or selecting a file:
- Use a Find Library Files or Write To Library node to obtain a file object.
- Connect the file object output to the File input of the Set Form File node.
- Configure the Page and Element inputs to target the specific file upload field in your form.
- Trigger the Set event (e.g., from a "Load Form Page" node or a button event) to populate the field automatically when the page loads.
[Find Library Files]
↓ (files output)
[Set Form File] ← Set (from Start or Event)
↓
[Load Form Page] ← Done
In this example, when the workflow starts, it finds a specific file in the library, sets it into the form's file upload field, and then loads the form page with the file already attached.