How To: Chain Named Queries with queryname2
Use queryname2 when a second named query depends on a value returned by a first named query.
When to use queryname2
How queryname2 works
Example
<!--{{!
<lineitemsSOQL>
<queryname>LatestOpp</queryname>
<soql>
SELECT Id, Name
FROM Opportunity
WHERE AccountId = '{{!Account.Id}}'
ORDER BY CreatedDate DESC
LIMIT 1
</soql>
</lineitemsSOQL>
}}-->
<!--{{!
<lineitemsSOQL>
<queryname2>TopLine</queryname2>
<soql>
SELECT Id, Quantity, TotalPrice
FROM OpportunityLineItem
WHERE OpportunityId = '{{!LatestOpp.Id}}'
ORDER BY TotalPrice DESC
LIMIT 1
</soql>
</lineitemsSOQL>
}}-->Rules to remember
Common fixes
Keep going
Last updated
Was this helpful?

