Generate a PDF from a record and email it
Section titled “Generate a PDF from a record and email it”This how-to is for builders who want a document to go out on its own: when a purchase request is approved, email the supplier the purchase order as a PDF; when a certificate is issued, send it to its holder. Nobody opens the record or selects an export.
It takes two reactions. The first generates the file. The second starts when the file is ready and emails it.
You need:
- Developer access on the module, to add templates and reactions.
- An export template for the document. See Export templates.
How it works
Section titled “How it works”flowchart LR A["Request approved"] --> B["Reaction 1: Generate File<br/>(Download Template on)"] B --> C["File ready"] C --> D["Reaction 2: Export File by template"] D --> E["Send Email<br/>with the file attached"]
The Generate File action does not save the file on the record. It announces that the file is ready, and the second reaction picks it up from there.
Step 1: Prepare a template for the automation
Section titled “Step 1: Prepare a template for the automation”- On the entity — for example Purchase requests — open the Templates tab and add a template. See Add the template to the entity.
- Set Level to Single Entry and Type to Pdf, and upload a Word
(
.docx) or HTML file. The Type decides the file you get: only Pdf gives a PDF; a Word template gives a Word document. - Give it a name that marks its purpose, such as Purchase order (email), and save.
Use a template of its own for the automation, and do not tick it in any view. The second reaction runs whenever a file is made from this template — including when someone exports with it from a view — so a template shared with people would send emails each time they export.
The template does not have to be offered in a view for the automation to use it.
Step 2: Generate the file
Section titled “Step 2: Generate the file”-
On Purchase requests, add a reaction with the event that should produce the document — for example On Workflow Step Reached on the Approved step. See Add a reaction.
-
Add the action Generate File.
-
In Template, choose Purchase order (email).
-
Leave Download Template on. It is what tells the second reaction that the file is ready.
-
Choose the file name. Pick a type, then a value:
-
Fixed — a name you type in File Name, such as Purchase order.
-
Field — a text field of the record, such as Request number.
-
Expression — a name worked out from the record, for example:
'PO-' + scope.entry.value.request_no
Without a name, the file takes the template’s name.
-
-
Save.
The person whose action set off the reaction also gets an in-app notification, Your file is ready to download.
Step 3: Email the file
Section titled “Step 3: Email the file”- On the same entity, add a second reaction with the event Export File by template.
- In Template, choose Purchase order (email).
- Add the action Send Email: the recipients in To, then a Subject and a
body. To put values from the request in them, use placeholders — see
Insert record values into messages.
The request’s own fields are offered
Since 1.8. - Turn on Attachment. In the attachment row, choose Field, then the File field — the file the first reaction made.
- Save.
Example. Subject: Purchase order {{po_no}}, with po_no mapped to the
Request number field; To: the supplier’s email field; Attachment: Field
› File.
Check the result
Section titled “Check the result”- Approve a test purchase request.
- You receive the Your file is ready to download notification, and the supplier receives the email with the PDF attached.
- If the email does not arrive, open each reaction’s run history: the first should show the file, the second the email. See Check that it ran.
Troubleshooting
Section titled “Troubleshooting”| Problem | What to check |
|---|---|
| The second reaction never runs | Download Template is off in Generate File, the second reaction chooses another template or none, or it is on a different entity. |
| The attachment is a Word file, not a PDF | The template’s Type is Word. Set it to Pdf. |
| The supplier gets an email every time someone exports | The template is also offered in a view. Keep a separate template for the automation. |
| The PDF is not produced | The service that converts documents to PDF is not running in your installation. Ask your administrator. |
| The template’s condition is ignored | Generate File does not check a template’s export condition. Put the condition in the first reaction’s filter. |
| The email has no attachment | In the attachment row, the type is not Field, or another file field is chosen instead of File. |
See also
Section titled “See also”Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27