Create dynamic documents
  • 13 Apr 2021
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Create dynamic documents

  • Dark
    Light
  • PDF

When you create a dynamic document, you can build and incorporate conditions and business logic to determine how the document appears to your customers. 

For example, you can create a terms and conditions agreement where some sections of the document are only visible to certain customers depending on where they live. 

This article describes how to create dynamic documents using the HTML Designer.

Note: 
You can use the dynamic documents to build a visual cart. For more information, see Create a visual cart.
🎦 Watch related video:

Create a new dynamic document

  1. In the Lightico Administration page, in the left pane, click Workflow > HTML Designer.

  2. In the top right corner of the page, click Create

  3. In the Create New HTML dialog box, select Dynamic document, enter a unique name for your document, and click Create.

    The new dynamic document opens.

    You can:

    For details, see the relevant sections below.

  4. Click Save.

Add and edit sections

You use sections to organize the information on your dynamic document. The customer does not see the actual division into sections. 

You use the built-in editor to design and edit the contents of your section.

You can set conditions to determine when the section will be displayed or to highlight a particular section. For more information, see Add conditions.

Within a section you can add the following elements:

  • Objects - You can add objects and set specific conditions for these objects. For more information. see Add objects.
  • Attributes - You can insert attributes by clicking the Add Attribute button or by entering the character
  • Functions - You can insert arithmetic functions into a section. For more information, see Add functions.

To create a new section, click the + button below the existing section.

To delete or duplicate a section, click the 3 dots in the top right corner of the section and select the relevant option:

Bind to form

Dynamic documents can only be used in a customer workflow when at least one section of the document is bound to a form. 

When a section is bound to a form, you can use attributes from the bound form to set conditions on the form. 

To bind a section to a form:

  1. Click the Bind to form button in the top right corner of the section:

  2. Select the form you want to bind to the section and click Bind.

Add sheets

You can add new pages to your document by adding a new sheet. A new sheet will always start on a new page in the rendered PDF.

To add a new sheet:

  1. Click the Add tab button in the top left corner.

  2. Enter a name for the sheet, and click Done.

    The new sheet opens displaying an empty section. You can add all the document elements to your new sheet.

Add objects

Within a section, you can add objects and you can set specific conditions on these objects. For example, there may be a sentence in your section that you only want to make visible under certain conditions. You can make that sentence into an object and set a condition on the object. For more information about conditions, see Add conditions.

To add an object:

  1. In the section where you want to create the object, select the part that you want to make into an object and click the Add object button.

  2. The object is added and a name is assigned to the object in the Object list. You can change the name of the object by selecting the name and typing a different one.

Add conditions

You can assign conditions to sections or objects in your document. 

Note:
If you want to assign conditions to a section, the section need to be bound to a form and you can only base the conditions on attributes from the bound form.

To add conditions:

  1. In the Conditions pane, click the Add new condition button.

    The condition window opens

  2. Enter the condition statement. For example, the attribute state_address contains California.

    You can combine multiple condition statements using And / Or logical operators. You can also create more complex conditions by including some condition statements in parentheses. For more information about working with conditions, see Setting conditions in workflows.

  3. Under Then, choose whether you want to apply the condition to a section or an object and select the relevant section or object.

  4. Click Add Actions to determine what you want to do if the condition is met. For example, select Show to make the section visible if the condition is met.

  5. To add additional results that will take place if the condition is met, click the + sign next to the Then statement. 

  6. Click Save.

Add functions

You can add arithmetic functions into a section. For example, you may want to include a function that calculates the price after a discount for a certain item:

In some cases, you can insert aggregate functions that calculate the sum total when there are multiple instances of the same function. For example, if you have a function called item_price that is used in more than one instance, you can insert an aggregate function that will calculate the total of all the item_price functions.

The type of functions you can add to a section depends on what type of section you are adding them to. Sections that are bound to a form behave differently to unbound sections. The following table summarizes the type of functions you can add to a section and what those functions can include:


Bound SectionUnbound Section
FunctionFunction can include:
  • attributes used in the form that is bound to this section
  • other functions that are defined in the current section
Function can include:
  • other functions from anywhere in the document
  • aggregate functions from anywhere in the document
Aggregate FunctionNot availableAggregate function can include other functions from anywhere in the document.

Add a regular function

  1. Click the Add Function button.

  2. In the dialog box that opens, click Create New.

  3. In the Create Function Dialog box, in the title box, enter the name of your function, for example item_price.

  4. In the function box, enter the function itself.

    • In bound sections, you can use the add function button or the add attribute button to include attributes and functions that are used in this section.
    • In unbound sections, you can use the add function button or the add aggregate function button to include functions and aggregate functions from anywhere in the document.

    For example, you can write the following function to calculate the price after a discount, that includes 2 attributes.

    @document.price - @document.discount
  5. Click Save to save the new function.

  6. To add the new function into the section, click the Add Function button again and select the function you just created.

  7. To edit or delete the function, click the relevant buttons next to the selected function.

Add an aggregate function

  1. Click the Add Aggregate Function button.

  2. In the dialog box that opens, click Create New.

  3. In the Create Aggregate Function Dialog box, in the title box, enter the name of your aggregate function.

  4. In the function box, enter the function itself. You can use the add function button to insert a function from anywhere in the document.

    For example, you can write the following aggregate function to calculate the total of all the item_price functions:

    item_price + 0
  5. Click Save.

  6. To add the new aggregate function into the section, click the Add Aggregate Function button again and select the function you just created.

  7. To edit or delete the aggregate function, click the relevant buttons next to the selected aggregate function.


Was this article helpful?