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

How To: Add Custom Headers and Footers to Tables

Add custom headers, section breaks, and summary rows to related list tables.

Use manual table markup around line item output when you need extra structure above or below the data.

Problem

You want to add total rows, summaries, or custom headers to your related list tables.

Solution 1: Custom Column Headers

Instead of field API names:

<!--{{!
<lineitems>
<listname>opportunitylineitems</listname>
<column header="Product Name">PricebookEntry.Product2.name</column>
<column header="Qty">quantity</column>
<column header="Price Each" prefix="$" format-number="#,###.##">unitprice</column>
<column header="Line Total" prefix="$" format-number="#,###.##">totalprice</column>
</lineitems>
}}-->

Solution 2: Summary Rows

Add a total after the line items:

<table>
  <thead>
    <tr>
      <th>Product</th>
      <th>Quantity</th>
      <th>Price</th>
      <th>Total</th>
    </tr>
  </thead>
  <tbody>
<!--{{!
<lineitems>
<listname>opportunitylineitems</listname>
<column>PricebookEntry.Product2.name</column>
<column>quantity</column>
<column prefix="$" format-number="#,###.##">unitprice</column>
<column prefix="$" format-number="#,###.##">totalprice</column>
</lineitems>
}}-->
    <tr>
      <td colspan="3" style="text-align: right;"><strong>TOTAL:</strong></td>
      <td><strong>${{!Opportunity.Amount format-number="#,###.##"}}</strong></td>
    </tr>
  </tbody>
</table>

Solution 3: Section Headers

Group products by category:

Tips

  • Use header="Text" for simple column renaming.

  • Add summary rows manually after the line item block.

  • Use colspan to span summary cells across columns.

  • Use separate line item blocks to segment data.

Last updated

Was this helpful?