Collections can be inserted into document templates to create automatically generated documents containing the items of that collection. In a document, collection items can be presented as tabular content using the {{\collection-table-row}} tag or as free-form content with the {{\collection-block}} tag.
Tabular (left) vs free-form (right) method
Adding collections to document templates
To include collections into auto-generated documents, define the collection's structure in a document template. Place an opening and a closing tag that wrap around the collection field placeholders. This code snippet is added once and automatically displays content for each item in your collection.
- Use the tabular method for a simple table presentation, suitable for single-line text content in collection items.
- Opt for the free-form method for more complex structures, multi-line text, or sophisticated table layouts.
Present tabular content with {{\collection-table-row}}
Follow these steps to add a dynamically sized table that adjusts its rows based on the number of items in the collection:
-
Insert a table into your document template and apply your desired formatting.
Ensure that your table sits on its own line and text wrapping is disabled. In Microsoft Word, right-click the table, choose Table Properties, and set Text-wrapping to None. -
Add the opening tag
{{\collection-table-row your_collection_name}}
directly above the table and the closing tag{{\end-collection-table-row your_collection_name}}
directly below the table.Replaceyour_collection_name
with the name of your collection. -
In the last table row, insert the
{{your_collection_name==>your_collection_fieldX}}
placeholder in the cell where you want that field’s content to display. Repeat this process for each collection field. -
Upload the template to a Create Document action.
-
There, map all placeholders to their matching nodes, including the collection itself. This will happen automatically if the nodes and placeholders share the same name(s).
Create more complex document structures by placing a table inside a cell, ensuring opening and closing tags wrap around the table.
Present free form content with {{\collection-block}}
Follow these steps to add a block that is repeated for each item in the collection:
-
In your document template, place the opening tag
{{\collection-block your_collection_name}}
where you want your collection block to display. In a new line, place the closing tag{{\end-collection-block your_collection_name}}
.Replaceyour_collection_name
with the name of your collection and ensure the tags sit on separate lines. -
Between the tags, add the
{{your_collection_name==>your_collection_fieldx}}>
placeholder for each collection field. -
Upload the template to a Create Document action node.
-
There, map all placeholders to their matching nodes, including the collection itself. This will happen automatically if the nodes and placeholders share the same name(s).
Known limitations
- Both methods only work for collections with more than one field. If your collection only collects, e.g., employee names, neither method will work. However, either method is possible if your collection collects employee names and positions.
- All collection fields must be in the same table row. Tables with one column per collection item are not supported.
- In the content of the collection block, use at least one placeholder referencing a collection field.
- Multiple collection blocks cannot be nested within each other.
- Collection blocks cannot be used outside the document body, such as in the document header, footer, or comments.