How to: Format and Summarize a Related List
Apply column attributes, conditional output, and aggregate SOQL to make related lists easier to read.
Once your query works, improve the output.
Use attributes to format values, handle blanks, and return cleaner tables.
Format each row
This example formats dates and currency, and replaces empty descriptions.
<table class="table1">
<thead>
<tr>
<th>Opportunity</th>
<th>Stage</th>
<th>Close Date</th>
<th>Amount</th>
<th>Description</th>
</tr>
</thead>
<tbody><!--{{!
<lineitemsSOQL>
<class>table1</class>
<soql>
SELECT Name, StageName, CloseDate, Amount, Description
FROM Opportunity
WHERE AccountId = '{{!Account.Id}}'
ORDER BY CloseDate DESC
LIMIT 10
</soql>
<column>Name</column>
<column render="RECORD.StageName == 'Closed Won',Won,RECORD.StageName == 'Closed Lost',Lost,RECORD.StageName"></column>
<column format-date="MMM d, yyyy">CloseDate</column>
<column prefix="$" format-number="#,###.00">Amount</column>
<column nullprefix="No description">Description</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>Build a summary table
Use aggregate SOQL when you need grouped totals instead of row-by-row detail.
Best attributes to use first
format-numberfor currency and numeric outputformat-datefor date and datetime valuesprefixandpostfixfor labels and unitsnullprefixfor fallback textsubstitutefor exact value swapsreplaceallfor partial text cleanuprenderfor row-level logicshowcolumnto hide a body column conditionallybreakeveryncharsfor long URLs or IDs
Rules to remember
Any field used in
rendermust appear inSELECTAggregate values should use aliases like
dealCountshowcolumnhides body cells onlyHide the matching header separately when needed
Keep going
Review Related List Attributes for attribute details
Review Related List Working Examples for more grouped and conditional patterns
Last updated
Was this helpful?

