For the complete documentation index, see llms.txt. This page is also available as Markdown.

Using Component Queries

Repeat a component once per record returned by a SOQL query.

Using Component Queries

Component Queries allow a component template to repeat once for each record returned by a SOQL query.

Use them for:

  • LineitemsSOQL

  • Related lists

This avoids standard table layouts and gives full control over styling.

Example 1: Repeating Opportunity Sections on an Account

Use case: Generate an Account document that includes a formatted section for each related Opportunity.

Parent Template (Account)

<!--{{!
<LineItemsSOQL>
  <component>Opportunity Summary Component</component>
  <soql>
    SELECT Id 
    FROM Opportunity 
    WHERE AccountId='{{!Account.Id}}'
  </soql>
</LineItemsSOQL>
}}-->

This query:

  • Retrieves all related Opportunities

  • Inserts the component once per record

Component Template (Opportunity)

Template Format: Component

If the Account has three Opportunities, this component renders three times.

Example 2: Scalable Queries Using Column Fields

Use case: Repeat a component for a large list of records while executing only one SOQL query.

Parent Template

Component Template

Last updated

Was this helpful?