Generation Link

Generate documents from Airtable records with any Airtable or Documint plan.

This is different than the native Airtable App integration.

How it works

Document generation links allow you to create documents from Airtable records with a link formula.

For example, a link like this:

placed in a button or formula field will generate a document when clicked like so:

Documint Setup

  1. Add your Airtable API Key to your Documint account under Settings > Integrations > 3rd-Party Integrations > Airtable. How to find your Airtable API Key

2. Create a Documint template

3. Add variables representing your Airtable fields into your Documint template Note: Field names need to be converted to snake case. For example, if you have a field named “Order Name”, you’ll need to place it in your Documint template as: order_name and wrap it in double curly braces like so {{ order_name }}.

Airtable Setup

In this section, you will create a generation link formula then paste it into a formula field in your Airtable table. This will render the generation link for each record in your table.

Use the formula builder to create your generation link formula.

Reference: Generation Link Query Parameters

Name

Description

Required

template_id

The id of the Documint template you will be generating documents from.

Yes

base_id

The id of the Airtable base that you will be generating documents from.

Yes

table_id

The id of the Airtable table that you will be generating documents from.

Yes

record_id

The Airtable record id. This will be generated by the Airtable RECORD_ID() formula function.

Yes

attachment_field

This is the name of the field you would like to attach the generated document back to. **Note:**Value must be URL Encoded. If is preview set to true this will have no effect.

No

preview

If set to true will generate a preview of the document. This document will have the Documint branded footer and will not count against your merge quota.

No

print_view

If set to will open the generated document in the browser's built-in PDF viewer where users can easily print the document.

No

  1. Paste the generated formula into either an Airtable Formula Field or a Button Field as shown below.

That’s it! Now, whenever a user clicks the button you’ve added a document will be generated for that record. If a document already exists with the data from that record and the template has not been changed, then the existing document will be displayed. This prevents generating the same document multiple times.

Additional Features

Expanding Linked Records

By default, Airtable only sends the Ids of linked records. If you want to include all of the details of linked records you need to tell Documint to expand those records.

1. Create a new formula field and give it the same name as the Linked Records field appended with Table_Id. For example, if your table has a Linked Records field named Order Line Items then create a new formula field named Order Line Items Table_Id.

2. Find the table id for the table that the Linked Records belong to (in the case above it would be the “Order Line Items” table) and paste it into the formula field.

By default, Documint will only expand records one level deep. To expand multiple levels deep add the query parameter expand=[1-5] to your generation link. For example, if you want to expand 3 levels (relationships) deep then you will want to add [...generation_link]&expand=2 to your generation link.

Password Protection

To add password protection, simply add a text field to your table with the name Documint Password (note the spelling of “Documint”). The value entered in that field will be the password protecting documents for that record.

The user will see this screen the first time they try to access the document or if the password is changed in Airtable.

Attach Document to Record

This feature will attach documents back to their record in Airtable after they are generated.

To use this feature, first, create a new Attachment field or use an existing one. Next, add the following query parameter to Generation Link: &attachmemnt_field_name=[your+attachment+field+name] . Replace [your+attachment+field+name] with the name of the attachment field that you would like to attach the document to. Keep the capitalization the same but replace any spaces with + .

We recommend using the Formula Builder to create the entire Generation Link formula.

Preview Mode

Preview mode will generate a new document every time it is run, however, the document is never stored, has a branded footer, cannot be shared, and will not count against your quota.

As the name implies, this feature is intended for previewing what the document will look like before generating a live document.

Below is an example of what the user will see in Preview mode.

Duplicate Document Avoidance

By default, Documint will first check if a document has already been created using the same template and data before creating a new one. If a document has already been created, Documint will return the existing document. If not, it will create a new document. This prevents the same document from being generated more than once and counting against your quota multiple times.

There may be cases where you want/need more fine-tuned control over this functionality. In those cases, you can tell Documint specifically which fields in your data to watch for changes. This is accomplished using the watch_fields or ignore_fields query parameters in the Generation Link URL.

Setup

To use this feature, you will need to add either watch_fields or ignore_fields as a query parameter to your Generation Link. If both parameters are passed, only the watch_fields parameter will be evaluated. Add a comma-separated list of field names, in snake-case, as the value for the parameter.

Field names must be converted to snake-case when used in this query parameter.

Every time a document is created, Documint creates a hash of the data that is being merged and the template. This allows Documint to detect changes in either without ever storing your data.

Parameter

Description

watch_fields

This parameter tells Documint to create a new document only when the fields specified in this parameter change.

Example:

[...]&watch_fields=name,toatl_amount

In this example, a new document will only be created when the value of either the Name or Total Amount fields has changed.

ignore_fields

This parameter tells Documint to ignore changes made to the fields specified in this parameter and only create a new document when the values of fields other than the ones specified have been changed.

Example:

[...]&ignore_fields=last_modified_date

In this example, a new document will be created when the value of a field other than Last Modified Date is changed.

Last updated