BetaAction
Generate document
Beta — ready to use, but some details may still change.
Overview
Prints a Document component's document for a record (opens the printable page, where people can save it as PDF) or attaches it privately to the record's file field.
Purpose
Print a quotation, purchase order, work-order report, inspection report or receipt from a button, a table row or the end of a sign-off flow.
Inputs
- Document — a Document component on the same page (it defines the template, fields and line items).
- Record id — which record to print; empty uses the current record (the row or page record that triggered the action).
- Attach — store the document in the Document's Attach to file field instead of opening it.
Configuration
- The Document component decides what is printed; the action only says which record and whether to attach.
Outputs
- Attach: Results › last is the private link of the attached file (signed for the current user).
Example
Attach the work-order report after sign-off
Example
Button “Complete job” › On click:
1. Update record (Status = Completed)
2. Generate document
Document: Work order report · Record id: Page parameter id · Attach: yesErrors
- “Record not found” — the user's role can't read that record.
- “You can't change …” — attaching needs update permission on the record and a writable file field.
- Pop-up blocked — printing opens a new tab; allow pop-ups for the app.
Limitations
- PDF files come from the browser's print dialog; no PDF is generated on the server.
- Not available in sandboxed demos and template previews.
Advanced
- Schema:
{ type: "generate_document", componentId, recordId?: Binding, attach?: boolean }. Runs in the browser; the server re-checks the component's visibility and the record's permissions (/api/runtime/:projectId/documents/:componentId).