Skip to main content

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

InputTypeDescriptionDefault
SetEventTriggers the node to set the file in the target form element.-
PageData (DropDown)The display name of the page containing the target file input element.-
ElementData (DropDown)The display name of the form element (file input) that will receive the file.-
FileDataA file object from the library containing at minimum an id field referencing the document to be set.-

Outputs

OutputTypeDescription
DoneEventFires 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:

  1. Validation: Checks that the provided file input is a valid object containing an id field. If invalid, the node exits without firing Done.
  2. Resolution: Looks up the internal page ID and element ID based on the provided display names.
  3. Security Tokenization: Creates a JWT-signed fileToken containing the document ID and project ID, then constructs a new file value object where the original id is replaced by this token.
  4. Data Persistence: Writes the file data to the workflow's runtime form data storage at the path formData/{pageId}/{elementId}.
File Object Structure

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:

  1. Use a Find Library Files or Write To Library node to obtain a file object.
  2. Connect the file object output to the File input of the Set Form File node.
  3. Configure the Page and Element inputs to target the specific file upload field in your form.
  4. 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.