Filtering, Sorting, and Grouping Your Related List Layout

Table Styling Options

There are many advanced features you can leverage to enhance how your related list items are rendered.

To use these, you would need to edit your template source. The example below shows a combination of advanced features including:

  • Leverage CSS to control table styles such as borders, alternate background colors on rows, and change width and alignment text within columns.
  • Format numbers and add prefixes to column values.
  • Use a <where> clause to filter records, and <limit> to control set size.
  • Use <orderby> to sort by particular column(s).
  • Use <groupby> to “break” the table for different sets of values.
    • <groupby> value must be first column in related list
  • Use <groupbyheader> to specify repeating column names.
  • Use <groupbysum> to insert running subtotals of each group.
<style type="text/css">
table.table1 {border:solid black 1px;border-collapse: collapse;border-spacing:0px;font-family: verdana; font-size: 10pt; width:100% }
.table1header {text-align:center;font-weight:bold;border:solid black 1px;}
.table1footer {text-align:right;font-weight:bold;border:solid black 0px;}
.table1col0 {font-weight:bold;text-align:left; border:solid black 1px;}
.table1col1 {text-align:left; width:20%;border:solid black 1px;}
.table1col2{text-align:left; width:40%;border:solid black 1px;}
.table1col3{text-align:right;width:10%;border:solid black 1px;}
.table1col4,.table1col5{text-align:right;width:15%;border:solid black 1px;}
.table1RowEven{ background-color:#fff; }
.table1RowOdd{ background-color:#eee; }
</style>
... your template HTML here...
<table class="table1">
<!--{{!
<LineItems>
<class>table1</class>
<ListName>opportunitylineitems</ListName>
<column>PricebookEntry.Product2.family</column>
<column>PricebookEntry.name</column>
<column>PricebookEntry.product2id</column>
<column format-number="#,###" postfix="/Per Unit">quantity</column>
<column format-number="#.###,##" postfix="€">unitprice</column>
<column format-number="#,###.##" prefix="$">totalprice</column>
<where>PricebookEntry.name != null</where>
<orderby>PricebookEntry.Product2.family</orderby>
<groupby type="newtable">PricebookEntry.Product2.family</groupby>
<groupbyheader position="after-group">Product Name,Product Description,Qty,Unit Price,Total Price</groupbyheader>
<groupbysum position="footer" format-number="#,###" prefix=" Subtotal $">totalprice</groupbysum>
<limit>100</limit>
</LineItems>
}}-->
</table>

Using Components

If you need to format your related list data in an entirely new way (e.g. structure it in any way you like outside of a table), you can also include a template component that formats your data and then merges it into your final document. Click here to read more about this feature.

Tags: , ,

Was this helpful?