Auto-generated Content Data-Repeat Attribute

The data-repeat attribute repeats the HTML element it is placed on for every child record you are looping through. As it loops through the child records, you can access field values specific to each of those individual records.

Syntax Overview

Place the syntax below into the HTML element you want to repeat.

data-repeat="variable_name in object_name"

variable_name: user-defined name for a record in the object array, or list of child records

object_name: an object array from a data source (such as OpportunityLineItems in Salesforce)

For example, to repeat a <div> element over OpportunityLineItems, it would look like:

<div data-repeat="product in OpportunityLineItems">

To access and display the field values in your document, use the following syntax:

[variable_name.FieldName]

FieldName: the variable name of the field you want pulled into the document as defined in the Incoming Data section of your Collaborate-Salesforce integration

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 HTML:

<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 in an unordered list.

<p><strong>Product Name:</strong></p> <ul> <li data-repeat="item in OpportunityLineItems">[item.PricebookEntry.Product2.Name]</li> </ul>

The output displays as:

Product Name:

  • Bronze
  • Silver
  • Gold
  • Platinum