Generating documents#
How a user produces a document from a record, what happens behind the scenes, document packets, PDF merging, the one-click button, and how generated files are named.
From a record page#
- Open any record — Account, Opportunity, Case, a custom object.
- Use the Welisa Runner component on the page.
- Pick a template. The picker is grouped by Category; the object's Default template (★) floats to the top and Sort Order breaks ties; a category dropdown filters long lists.
- Choose Save to Record (attached to the record's Files), Download (sent to your browser), or Save & Download (both, from one generation).
- Optional: override the output format if the template is not locked.
- Click Generate.
Save & Download is offered whenever a placement leaves both Download and Save to Record enabled. The document is generated once. For PDF it uses the same background generation as Save to Record, waits for the file to land on the record and then hands it to your browser — so there is no size ceiling on either half. For Word, Excel and PowerPoint the file is assembled in your browser, so both copies are immediate; above roughly 5 MB a drag-to-attach box appears, exactly as Save to Record does.
When a placement leaves only one destination enabled, the selector disappears and users simply click Generate.
Where the runner can live#
Record pages, App pages, the Command Hub, Experience Cloud pages, Flow screens and the utility bar. In Lightning App Builder each placement has its own toggles — Show Download Option, Show Save to Record Option, Show Save & Download, Show Document Packet Mode, Show Combine PDFs Mode — so a page can hide what it does not need. On an App page or its own tab, tell the runner which object to search and users find the record inside the runner; a fixed Record ID makes a page that always produces the same document. On mobile the runner is save-to-record only; packets and combines are desktop features.
What happens behind the scenes#
- The runner scouts child record counts before generating.
- Small datasets run the full in-memory merge and return in well under a second for most templates.
- Datasets too large for the synchronous heap switch transparently to the background large-dataset path. You never choose sync versus async.
- Word, Excel and PowerPoint output is assembled in the browser, which bypasses the platform's 4 MB response limit.
- PDF output is rendered server-side; very large PDFs are streamed in chunks and stitched client-side.
Output format override#
If the template is not locked, users see a toggle between the native format and PDF. Flow actions accept the same override through outputFormatOverride. Lock the template (Settings → Lock Output Format) for documents that must always be one format.
PDF merge — combine with existing PDFs#
When the output is PDF and the record has PDF files attached, the runner offers Combine with existing PDFs: selected files are appended to the generated document into one PDF — signed contracts, terms, exhibits. The standalone Combine PDFs mode merges two or more of the record's existing PDFs with drag-and-drop ordering, with no template at all.
Five ways to combine, in total:
| Mode | What it does |
|---|---|
| Generate & Merge | Generate a document, then append existing PDFs from the record |
| Document Packets | Generate from several templates and merge into one PDF |
| Merge Only | Combine existing PDFs on the record |
| Child Record PDFs | Pull PDFs from child records (all Opportunity PDFs under an Account) |
| Bulk Merge | After a bulk job, merge every generated PDF into one download |
Document packets#
A packet is several templates generated in one action and merged (or sent as one signature session). Select multiple templates in the runner, generate, and they are combined; tick include existing PDFs to fold record files in after the generated documents. For signature packets see E-signatures.
One-click button#
For "this object always generates this one template", add the Welisa Button quick action to a record page: one click generates and downloads the document, with no runner and no Flow.
Configure a button from the Command Hub (recommended). Command Hub → Buttons → New Button → pick the object, the template, optionally which record types show it, a document title, output-format override, save-to-record, sort order and active flag. Saving deploys a Welisa Button custom metadata record for you (asynchronous — the button appears in the list a few seconds later).
Because this deploys metadata, the Buttons tab is a deliberately separate capability: it appears only for a user who holds Welisa Button Manager and Salesforce's Customize Application (or Modify Metadata Through Metadata API Functions) permission. Welisa DocGen never grants the latter itself.
Configure via Setup (classic). Setup → Custom Metadata Types → Welisa Button → Manage Records → New. Set Object API Name and either Template API Name (environment-stable, deploys cleanly) or Template Id (takes precedence when both are set); optionally Save To Record, Output Format Override, Document Title, Sort Order and Record Type Developer Names (comma-separated; blank = every record type). Only active records are offered.
Then:
- Access — Welisa User and Welisa Admin already include the button; Welisa Quick Action grants it on its own.
- Place the action — Object Manager → your object → Buttons, Links, and Actions → New Action → Lightning Web Component →
docGenButton, then add it to the record page or page layout. Creating the configuration does not place it automatically.
With one active configuration for the record's type the click generates immediately; with several, a small picker appears. Save To Record also attaches the file. Limitation: this is a synchronous path — templates over the large-dataset threshold (about 2,000 child rows) show an error; use the runner or a Flow for those.
Document naming — Document Title Format#
The template's Document Title Format (Settings tab) names every generated file — runner, bulk, Flow, quick action and signed PDFs alike. Blank = the template name. Tokens resolve against the source record:
| Token | Example |
|---|---|
{Field} / {Parent.Field} | Invoice - {Name}, {Account.Name} Summary |
{Today} / {Now} with a date pattern | Quote {Today:yyyy-MM-dd} |
{RunningUser.X} | Prepared by {RunningUser.FirstName} |
| Format suffixes | :label, :date, :date:locale, date and number patterns — the same grammar as body tags |
Fields used in the title do not need to be in the Query Configuration. A documentTitle passed at runtime (a Flow input, a button configuration) wins over the template's format.
Preview before activating#
Set a Sample Record on the template, then use Download Sample or PDF Preview in the designer, or Preview Sample PDF in the bulk runner, to check the output before anyone else generates with it. Rich-text inline images only render through the runner, not through Generate Sample.