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

Use lineitemsSOQL for multiple filtered related lists

Avoid shared filter behavior when one template contains more than one filtered related list.

Use lineitemsSOQL when a template includes more than one filtered version of the same related list.

Legacy <lineitems> blocks can apply one filter to both lists. lineitemsSOQL keeps each filter separate.

Problem

If one template contains multiple legacy related lists with different <where> clauses, both lists can render using the same filter.

This usually appears when you split one related list into separate sections, such as:

  • hardware products

  • service products

  • open items and closed items

Solution

Convert each legacy related list to its own <lineitemsSOQL> block.

Each block uses its own SOQL query, so each list keeps its own WHERE, ORDER BY, and LIMIT logic.

What to change

1

Change the tag name

Replace <lineitems> with <lineitemsSOQL>.

2

Use the object name in the query

Query the Salesforce object in the FROM clause.

Use OpportunityLineItem, not the relationship name opportunitylineitems.

For custom objects, replace __r with __c.

3

Add a WHERE clause that ties the child object to the parent record.

Example: WHERE OpportunityId = '{{!Opportunity.Id}}'

4

Select every displayed field

Any field you display in a <column> should also appear in SELECT.

Example conversion

This legacy related list filters Opportunity Products by product family.

Convert it to lineitemsSOQL like this:

If you need a second list, create a second lineitemsSOQL block with its own WHERE clause.

For example, a second block could filter Family = 'Services' without affecting the first block.

lineitemsSOQL is the right choice when one template needs multiple filtered views of the same related list.

Key detail

opportunitylineitems is a relationship name. OpportunityLineItem is the object name.

That object name belongs in the SOQL FROM clause.

Keep going

Last updated

Was this helpful?