Building a placeholder system for emails and documents

Building a placeholder system is very handy for re-using email and document templates sistematically. An example: your company has a rental agreement template which is used to generate individual agreements. For every agreement, some parts have to be selected or filled in, depending on the situation.

Instead of creating a bunch of templates which forces the employee to select the right template, there is only one template in which you can use specific text, depending on choices.

Depending on choices in Pick lists , the application selects certain pieces of the template and creates an Rental agreement with the applicable content from the template.

After that, the only thing the employee needs to do is to fill the placeholders. The application then replaces the placeholders with their content and generates a PDF file.

In this example, we’ll show you how to build this with a rental agreement.

(Note that we won’t use the complete agreement, but just enough to show you how it works.)

Step 1: set up the data items

First create the Contract template.

Every section in the contract has its own property. We have two sections: Intro and End date.

The content of section End date depends on a choice (end date or not). There is a property for both options.
Rental agreement template

Create the User Rental agreement.

This data item contains the tenant (a reference to one User) and a property for each section.
Property for each section

Step 2: design the flow part Lookup rental agreement text

This flow part fills the rental agreement with content from the template.
Lookup rental agreement text flow part

  1. Input: the created Employment contract.
  2. Depending on the choices in the Pick lists, retrieve the content from the template that applies.
  3. Update the contract with the content from the template.

Step 3: design the flow part Fill Rental agreement that fills the placeholders

Fill rental agreement flow part

First, define the inputs. Every placeholder is an input.
Inputs definition

For every input, create a Calculation that replaces the placeholder with the applicable input.

In the first calculation, use the applicable section of the Employment contract:
First calculation

For the other calculations, use the previous formula:
Other calculations

Update the contract with the modified sections. You can do this per section after the flow has replaced all placeholders in it, or do it at the end for all sections at the same time.

Step 4: create the user flow Rental agreements

Create the user flow using the wizard.

Change the appearance of the form fields for sections in the Create and Edit pages to from Simple to Multiple lines of text.
Rental agreements user flow

The flow process

  1. Add a Rental agreement. This page contains form fields for the tenant and the start and end dates.
    Rental agreement

  2. From there, create a rental agreement with only these properties.

  3. Call the flow part Lookup Rental agreement text. This will fill the contract with the applicable content, depending on the selections in the picklist.

  4. Create the page Fill placeholders. The left side of the page shows the sections in the contract. The right side of the page shows the Form fields for the content of the place holders.
    Fill placeholders

  5. Call the flow part Fill Rental agreement that replaces the placeholders with the provided content. Provide the necessary inputs.

  6. Proceed to the Overview page or an Edit page, where the rental employee can modify the agreement where needed.

Step 5: create a flow part to generate the PDF

Now you collected all information, you can create a PDF. In the PDF you can create a good looking document with additional information like contact and logo.

Design a flow part to do this. Store the PDF in the agreement.

You can also send an email to the tenant with the PDF attached.
Flow part to generate the PDF

The PDF file setup

PDF setup

The final PDF file

PDF overview

The process

Add rental agreement
Fill placeholders
Edit user employment
Rental agreement overview