Skip to main content
Conga Support

Auto-generated Content Data-Repeat Attribute

data-repeat

The data-repeat attribute will repeat the HTML element it’s placed on for every record in an object array (Conga Collaborate creates an array of data from the child records on the object). As it loops through the records in the object array, you can access field values specific to each of those individual records.  

Syntax: data-repeat="variable_name in object_name"
variable_name: user-defined name for a generic record in the object array
object_name: an object array from a data source (such as OpportunityLineItems in Salesforce)

Within an element using the data-repeat attribute you can access field values by using the following notation:

[variable_name.FieldName]
FieldName - the variable name of the field you want pulled into the document (replace FieldName with the actual name of the variable).

For example, consider an array of five Widgets.  Each of these Widgets has specific fields such as Name, Description, and Price.  To access these fields for each Widget in the array of Widgets, set up the following auto-generated content using data-repeat:

<div data-repeat="widget in Widgets__r">
   <p>[widget.Name]</p>
   <p>[widget.Description]></p>
   <p>[widget.Price]</p>
</div>

"widget in Widgets__r" defines the generic record widget within the array Widgets__r.  Widgets__r (the Salesforce API name for Widgets) tells Conga Collaborate which object array to loop through, and the [square brackets] let Conga Collaborate know to evaluate the text within the brackets as variables.  The format [widget.FieldName] is the proper notation for accessing fields that live on records in the array. Each time you use [widget.FieldName], you are only looking at one specific record in the array.

In the example above, the data-repeat would repeat the Name, Description, and Price five times, once for each Widget.  As data-repeat implies, Conga Collaborate repeats through the array looking for the next Widget each time through.  The first repeat begins by looking at the first widget in the array and accessing its Name, Description, and Price. Then the second repeat looks at the second widget in the array and accesses its Name, Description, and Price, and so on through the fifth widget in the array.

Consider another example where a Salesforce Opportunity has four products on it, named Bronze, Silver, Gold, and Platinum, and we want to display the Product Name for each product on their own line on the page.

HTML:

<div data-repeat="item in OpportunityLineItems">
   <p>[item.PricebookEntry.Product2.Name]</p>
</div>

Output:

Bronze

Silver

Gold

Platinum
  • Was this article helpful?