Skip to main content

Generate Repeating Sections in Documents with Multiple Records

Updated over a month ago

Overview

This section explains how to add loop tags to document templates in docuWeaver.

Loop tags allow you to dynamically populate multiple Salesforce records within a document. They enable specific sections of a template to repeat for each record in a related list or collection, ensuring accurate rendering of multi-record data in generated documents.

  • List Start Tag marks the beginning of a repeating section.

  • List End Tag marks the end of a repeating section.


Example

Goal:
Create a document template that displays a list of software licenses, outputting the name and price for each license.

Template (Loop.docx)

{#$r.products__ch}

{r.products__ch.name}, {r.products__ch.price} €

{/}

Sample Data

{   

"products": [
{ "name": "Windows", "price": 100 },
{ "name": "Mac OSX", "price": 200 },
{ "name": "Ubuntu", "price": 0 }
]
}

Rendered Output (loop-output.docx)

Windows, 100 € 
Mac OSX, 200 €
Ubuntu, 0 €

docuWeaver repeats the content between the List Start and List End tags for each record in the collection.


Steps to Add Loop Tags

  1. Prepare the document template in .docx format.

  2. Log in to Salesforce and open the docuWeaver application.

  3. Navigate to the Data Set section.

  4. Click Edit on the data set that retrieves the required Salesforce data, including related records.

  5. Open the Field Tagger section.

  6. Select the child object containing the records to be repeated (for example, Products).

  7. Copy the List Start tag ({#objectname__ch}) and List End tag ({/}) from the right panel.

  8. Insert the List Start tag at the beginning of the repeating section in the template.

  9. Add the required field placeholders and static text between the List Start and List End tags.

  10. Insert the List End tag to close the loop.

  11. Save the template and upload it to docuWeaver.


Note

To identify loop tags:

  • Open Field Tagger

  • Select a child relationship object

  • Loop tags start with # followed by the child object fields

  • The { / } tag is used to end the loop

These tags define the section that repeats for each record in the related list.

Did this answer your question?