Skip to main content

Generate your first pdf document from Fibery

Video Tutorial

The contents of this tutorial are available as YouTube video as well. If you prefer, you can watch it here

Pre-requisites

Make sure you have connected your Fibery account to FlexiPage. Workspace url and API key are required to connect Fibery to FlexiPage. Learn more about creating api token here. Visit Settings page in FlexiPage to connect Fibery.

Space & Database Setup

A quick overview of the Fibery setup we'll be using in this tutorial. We have Photo Studio space with Client, Equipment, Invoice, Invoice Line Items database. Our goal is to automatically create invoice documents from Invoice database entities.

Some fields of Invoice database:

  • Has a Client field which has a single relationship to Client database entity
  • Has a Line Items field which links to multiple Equipment database entity
  • Has a state workflow field which has statuses Draft, Sent and Paid
Invoice database Fibery

Create Document Template

We have a logo, Invoice number, Client information and line items table. We'll first start with logo. First create a new document and select the Invoice database entity.

tip

While creating document templates, save and toggle the preview tab to see a preview of your document with fibery data

  1. Select the Image component from the components library by typing / in the editor.
  2. If you have a static logo, hover over the image and select upload button and add your image.
  3. For dynamic logo, select the image placeholder with left mouse click. On the right panel you will see a dropdown for field selection. Select a file field and preview to see the image.
Components Library

Invoice number and client information

In our Invoice database we have Invoice Number as a text field and Client as a Relation field. You can just type Invoice Number : followed by @. Once you type @ you'll see a drop-down of all the fields in the Invoice database. Type for the field name and select the Invoice Number field.

Since Client is a relation field, you will be able to access fields from the Client database itself.

tip

If you want the information to be presented side by side, you can use our column component.

Fibery Variables

Line Items table

Quickly create a table from Invoice line items field which is a one-to-many relation field.

  1. Type / in the editor and select Dynamic Table Component.
  2. In the dialog that appears, select Invoice Line Items field and choose which fields from Line Items database you want to display in table
  3. You can add/remove more columns by clicking on the three dots icon when hovering over the table.
tip

You can control table styles (Borders, colors, alignment) from the right side properties panel. You can also sort and filter table rows based on field values. Check our Line Items Guide for more details.

Editor View

Preview Document

Preview always comes from the first entity in Fibery database. In our case, Invoice. Click the preview tab to see the merged document.

Editor View

Setup Automation

Save the document.

  1. First add delivery option to the document. Click on Delivery tab and select Upload to attachment field option. Choose a file field and save.
  2. Next, in the document editor, click on the Automation Instructions Icon which is located after the save button. Copy the automation code.
  3. In Fibery, go to the Invoice database and add a new automation rule. Select Invoice Updated trigger, fields to monitor as state and add a filter to check state is in sent state. Whenever an invoice status is changed to sent, the automation rule will run.
  4. In the action section, select Script option and paste the automation code. Click on Save Automation Rule button.
  5. Now whenever an invoice state is changed to sent, the document will be automatically generated and uploaded to the file field specified in the delivery option.
PDF Merge