Sort related lists and tables

Related lists and tables can be sorted to a specific order when using the template builder in the Drive Connect app. Use this tool to display the most important information first in your lists and data tables in a logical manner.

Note: Merge fields in a data table must all have the same sorting criteria in order for the document to generate.

  1. Choose the template you would like to edit
  2. Choose a related object from the Field or Related Object dropdown list
  3. Choose the field from that related object you would like to display
  4. Click on the filter and sort button
  5. Click on the Sort By drop down and choose the determining field for sorting
    • Choose whether the field should be sorted ascending or descending
  6. Copy the merge field and add it to your Google Doc

Table example: Displaying products from an Opportunity using the sort filter on name ascending

All products from an Opportunity (no filter)

Merge Table

Product Sales Price Quantity Total Price
{{!Opportunity.r.OpportunityContactRoles.Contact.Name}} {{!Opportunity.r.OpportunityContactRoles.Contact.Email}} {{!Opportunity.r.OpportunityContactRoles.Contact.Phone}} {{!Opportunity.r.OpportunityContactRoles.IsPrimary::true::false}}

Result

Product Sales Price Quantity Total Price
CRM Deployment $10,000 1.00 $10,000
Maintenance $7,500 1.00 $7,500
SEO $8,000 1.00 $8,000
Architecture $5,600 1.00 $5,600
Website Deployment $12,000 1.00 $12,000

All Products on an Opportunity using sort on the product name ascending

Merge Table

Product Sales Price Quantity Total Price
{{!Opportunity.r.OpportunityLineItems::ORDER_BY(Name,ASC).Product2.Name}} {{!Opportunity.r.OpportunityLineItems::ORDER_BY(Name,ASC).UnitPrice::Symbol}} {{!Opportunity.r.OpportunityLineItems::ORDER_BY(Name,ASC).Quantity}} {{!Opportunity.r.OpportunityLineItems::ORDER_BY(Name,ASC).TotalPrice::Symbol}}

Result

Product Sales Price Quantity Total Price
Architecture $5,600 1.00 $5,600
CRM Deployment $10,000 1.00 $10,000
Maintenance $7,500 1.00 $7,500
SEO $8,000 1.00 $8,000
Website Deployment $12,000 1.00 $12,000