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 document from an automation and email or WhatsApp it

Add a Generate a document step to an automation: it prints the template for the record and saves it in a file field. The next steps then send it as an email attachment, as a file on WhatsApp, or as a link in a message.

7 min

Automations are a paid add-on, shown with an Add-on badge.

Before you start · 2 things · for owners and managers
A template and a file field on the unit, an automation

Steps

1
Add a Generate a document step to the automation.
2
Under Save it onto, choose the record: This record, The record a Find step found, or A record linked to it (up to 2 relations away, and the first record is used).
3
Under Template, choose the template.
4
Under Save it into, choose the file field. Under Files already in the field, choose Keep them or Replace them.
5
Under Call it, give the document a short name in English letters that the next steps use, such as “Invoice”.
6
Optional: type a File name, and turn on Also set the template’s status if the template moves the status on save.
7
Under Only when these are filled in, the fields the template prints are ticked for you: untick any it can do without, and choose what happens If one is empty.
8
After it, add Send an email with the document attached, or Send a WhatsApp message with the document as a file.
Try it with Practice run: messages reach only you, and the document step doesn’t print a PDF.

Settings

Setting
What it does
Template
Must print the target record’s unit
Call it
English letters and numbers, starting with a letter: “Invoice” is saved as invoice. Up to 30 characters, and it can’t repeat in the automation
File name
Empty = the record’s title. .pdf is added automatically
Keep them / Replace them
Replacing leaves only the new document in the field
Also set the template’s status
Applies the status setting in the template. If the status is refused, the document is still saved and a warning shows in the log
Only when these are filled in
If any of them is empty, the document isn’t generated
If one is empty
Stop here on this path (it doesn’t count as a failure), or Carry on without a document

Using the document in the next steps

Variable
Value
{{document.invoice.url}}
The PDF link, valid for 7 days from when the step that sends it runs
{{document.invoice.name}}
The file name, with .pdf
{{document.invoice.size}}
The size in bytes

In Send an email, add the document as an attachment, or attach every file in a file field. In Send a WhatsApp message, choose to attach the document as a file, or put the link in the text.

Who prints

The document prints with the permissions of the automation’s creator: it contains only what they could download themselves. If they lose the permission to read the unit, the step fails.

A ready-made template

In the automation templates gallery: “Send the invoice on WhatsApp and by email when the deal is won”. It needs an invoice template and a file field in the deals unit.

If something goes wrong

What you see
Why
What to do
“Template not found”
The template was deleted.
Choose another template.
“The template prints another unit”
The template doesn’t match the target record’s unit.
Choose a template on the same unit.
“The field isn’t a file field”
The field was deleted, or its type changed.
Choose a file field.
“Skipped — there was nothing to do for this record.” in the run’s History
A field under Only when these are filled in was empty. The run still ends Done, and nobody is notified.
Fill in the field, or change If one is empty. A Practice run on that record names the empty fields.
“The automation’s creator doesn’t have permission”
The creator lost the permission for the unit, or left.
“Another Generate a document step already uses this name.”
2 steps have the same name under Call it.
Choose another name.
The email wasn’t sent and the attachment is missing
The generate step didn’t run on this path.
Put the generate step before the email, on the same path.
The step is “Waiting”
The PDF engine is busy with other documents.
Do nothing: it finishes on its own.

A real example

Shield Security Co.
The situation

Invoices were sent by hand, days after the contract closed.

What they did
  1. Trigger: “Status” changes to “Approved”.
  2. Generate a document: the “Tax invoice” template, called “Invoice”, saved into the “Invoice file” field, only when the amount and email are filled in.
  3. Send email with invoice attached, then a WhatsApp message with the file.
The result

The invoice reaches the client by email and WhatsApp within a minute of approval.

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

Good to know

Email attachments are up to 18 MB together. Otherwise, the email isn’t sent.
The document link is valid for 7 days.
A linked record can be up to 2 relations away.
If the PDF engine is busy, the step waits and retries for up to 6 hours, without counting it as an attempt.
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.