All topics
Get started8Account, team & permissions44Units & fields70Records, views & tasks39WhatsApp & Cortex Chat68Email & social27Lead ads & distribution38Automations52Documents & quotes32Dashboards40Cortex AI18Developers & API12
Help Center·448 guidesAll topicsContact support

Generate a PDF from a template and send it automatically

The Generate a document step prints a PDF document template for a record, saves it in a file field, and makes it available to the next steps so you can send it by email or WhatsApp.

7 min
Before you start · 2 things · for owners and managers
A document template for the unit, a file field in the unit

Steps

1
Press Add a step, choose Generate a document, then choose the template under Template.
2
Under Call it, name the document, such as invoice, for the next steps to use.
3
Under Save it onto, choose the target record.
The trigger record, a record you found, or a record reached through one or two relations.
4
Under Save it into, choose the file field.
5
Optional: a File name with record details. Without a name, the record’s name is used.
6
Under Files already in the field, choose Keep them or Replace them.
7
Optional: turn on Also set the template’s status, to move the record to the status set in the template’s settings.
8
Optional: choose required fields under Only when these are filled in.
Under If one is empty: Stop here, or Carry on without a document.

How it works

It’s printed as the automation’s creator. The document shows only what they could download themselves.

Sending it afterwards: in Send an email, add the document as an attachment. In Send a WhatsApp message, attach it under Attachments to send the PDF as a file, or put its link in the text with Insert a detail.

Variables: {{document.invoice.url}} is the link, {{document.invoice.name}} the name, and {{document.invoice.size}} the size.

If the record refuses the new status, the file alone is saved, with a warning.

If the PDF engine is busy, the step waits and tries again without counting an attempt.

The document is saved only once, even if the step is retried.

A practice run doesn’t print the document: it shows what would happen, and warns when a field it needs is empty.

If something goes wrong

What you see
Why
What to do
“Skipped — there was nothing to do for this record.”
A field under Only when these are filled in is empty. The run still ends as Done, and no one is told.
Fill in the field. A practice run on the record shows which field is empty.
“The template doesn’t exist” or “belongs to another unit”
The template was deleted, or it prints another unit.
Choose the unit’s template.
“The field isn’t a file field”
The chosen field isn’t a file.
Choose a file field.
“No permission”
The automation’s creator has left, or can’t see the unit.
Edit the automation as a member who has the permission.
“The PDF engine is busy”
The engine is under heavy load.
The step waits on its own, for up to 6 hours.
“The status wasn’t applied”
The record refused the move to the status.
The file is saved; check the status transitions.

A real example

Shield Security Co.
The situation

Quotes are printed and sent by hand.

What they did
  1. A field changes: the stage changes to “Approved”.
  2. Generate a document from the quote template into the “Quote file” field.
  3. Send an email with the document, and Send a WhatsApp message with the file.
The result

The quote reaches the client by email and WhatsApp within a minute.

A made-up company, to show the idea. The numbers are rounded.

Good to know

The document link is valid for 7 days.
Waiting while the PDF engine is busy: up to 6 hours.
Document name: starts with a lowercase English letter, up to 30 characters, unique in the automation.
Did this guide solve it?
If not, we’ll ask what was missing.
Open in Corteksa
Did this guide solve it?

We read every answer. To get a reply, use Contact support.