Repeats and conditional content
Two blocks let a template change with the data it is showing:
- Repeat for each repeats its contents once for each related record, such as each line item on an opportunity.
- Show if shows its contents only when a condition is true, such as “the account is in the Technology industry”.
Repeat for each
Section titled “Repeat for each”A Repeat for each block goes through a related list of the record and shows its contents once per item: one row per opportunity product, one block per contact, and so on.
Set up a repeat
Section titled “Set up a repeat”- Add a Repeat for each block. Or, in the Merge fields panel, insert a related list: Sliick Docs wraps it in a repeat for you.
- Pick the Source relationship, the related list to repeat over. You only see lists you have access to.
- Optionally, add a Filter to show only some rows, for example
Opportunities.StageName != 'Closed Lost'. See What a filter can read. - Optionally, open Sort and limit (optional) to sort the rows or print only the first few. See Sort and limit the rows.
- Choose how the rows appear: as stacked blocks, or as table rows (one table row per record). Table rows are the usual choice for invoices, statements and order summaries.
- Add merge fields inside the repeat. The Merge fields panel now shows the related object’s fields. A field such as
{{Opportunities.Amount}}fills in for each row.

Good to know
Section titled “Good to know”- Parent fields work inside a repeat, up to five levels up, for example
Opportunities.Account.Owner.Profile.Name. - Row order: with no sort set, rows print oldest first, in the preview and in the document. Every list, including a repeat inside another repeat, now prints in this same order each time. To choose the order, use Sort by.
- Repeats inside repeats work to any depth, for example an account that lists its opportunities, each with its line items. Sections, callouts and Show if blocks can go inside a repeat. You can repeat the same list at two levels (cases at the top, and cases under each contact), and a condition in an inner repeat can read the outer row.
- Signature blocks inside a repeat print each row’s value in the signer label.
- Activity History and Open Activities can’t be listed. Salesforce only lets admins read these lists, so they are not offered as a source, and a template that names one cannot be saved or published. A template already live with one keeps working as before (for admins only). To fix it, create a new draft, pick another related list, and publish.
- Editor preview of an empty repeat: when the filter matches no rows, the preview says “No rows match this repeat’s filter.” and the row under it shows each field’s fallback text, or nothing.
Sort and limit the rows
Section titled “Sort and limit the rows”A repeat, or a repeating table row, can sort its rows by a field and print only the first few. For example, “the five largest open opportunities”. New in 3.4.
- Select the repeat, or click a cell of the repeating table row.
- Under the filter, open Sort and limit (optional).
- Sort fields from: leave it on This row, or pick a lookup to sort by a field of that parent record (one level up). This appears only when the row has lookups.
- Sort by: pick the field. Record order (no sort) removes the sort.
- Order: Ascending or Descending.
- Show at most: a whole number from 1 to 9,999. Leave it blank to print every row.
The canvas labels the repeat with what you set, for example Sorted by Amount, high to low · first 5.
How it works:
- Filtered, then sorted, then cut. A filter of
Amount > 0, sorted by Amount high to low, at most 5, prints the five largest amounts.{{RowNumber}}counts 1 to 5. - Show at most limits what prints, not what is counted. A total over the list, such as
SUM, still adds up every row. - Picklists sort in their defined order, the order set in Salesforce, not A to Z.
- Text sorts without regard to capitals, so “alpha” comes before “Zeta”.
- Blank values sort last, whichever order you pick. Rows with the same value keep their usual order.
- Some fields can’t be used to sort: long or rich text, multi-select picklists, encrypted fields and lookup IDs. Sliick Docs stops the save if one is picked.
- The editor preview sorts the first 200 rows, and says so when there are more.
- List blocks have no sort or limit. Use a repeat instead.
The same sort and limit works in the PDF, in Word and in the preview.
Group the rows
Section titled “Group the rows”A list at the top level of the document, a repeat or a table’s repeating row, can group its rows by a field, such as each opportunity’s stage or each product’s family. New in 3.4; headers and subtotals as below in 3.5.
A grouped list has three parts:
- Group header: prints once per group, before its rows.
- Each row: the repeat’s content, or the repeating row. Prints once per row of the group.
- Group subtotal: prints once per group, after its rows.
To set it up:
- Select the repeat, or a cell of the table’s repeating row.
- Group by, right below the source: pick the field to group on. To group by a field of a parent record, pick the lookup under Sort fields from first. No grouping removes the grouping and its header and subtotal.
- Group order: Ascending or Descending.
- Optional: Show at most (groups), Show group subtotal, and Summary only, which leaves the rows out so the list prints one header and subtotal per group.
Turning Group by on adds a header that reads, for example, Stage: Prospecting (3): a heading on a repeat, and on a table a header row spanning every column. Turning the subtotal on adds a subtotal, and on a table a total under each number or currency column. Change them like any other content. A part you switch off keeps its content and shows on the canvas as a collapsed, labelled band; switching it back on restores it.
How groups work:
- Groups follow the field’s order: a picklist in its defined order, other fields A to Z. Rows with a blank value form their own group, printed last.
- The list’s filter runs first. Then the rows group, Show at most (groups) cuts the groups, and inside each group Sort by orders the rows and Show at most cuts them.
- The header and subtotal can print the Group by field, fields of the main record,
{{RowNumber}}(the group’s place: 1, 2, 3) and totals. The merge field list only offers these there. In the rows, every field of the row is available. - A group’s totals count all its rows that pass the filter, whatever Show at most cuts. A total can’t have its own filter. A total outside the list is a whole-list total.
- In a multi-currency org, a group’s total prints in its rows’ own currency. A group whose rows are in two currencies stops the document with a message.
- The editor preview shows the first two groups, each with its own totals, and says how many groups the document prints.
- On a striped table, each group starts with an unshaded row, and header and subtotal rows are never shaded.
- In a Word file, a table’s group header row stays with what follows it: a page does not end on a group header that has rows or a subtotal after it. In a PDF, a page can still end on a group header row.
What can’t be grouped, or go in a header or subtotal:
- a list inside another list can’t group;
- Approval history can’t group;
- a field that can’t be used to sort can’t be the Group by field;
- a field of the row, or any list, can’t go in a header or subtotal: put it in the rows.
Sliick Docs stops the save and explains if a grouped list breaks one of these rules.
Templates grouped in 3.4 keep printing the same. When you open such a draft, a simple 3.4 grouping turns into the new header, rows and subtotal, and the draft shows unsaved changes; saving keeps the new shape. Other 3.4 groupings print as before and offer Remove grouping or, for a table for each group, Convert to a grouped table. A published version is never changed.
Needs 3.5: a template using these headers and subtotals opens only in Sliick Docs 3.5 or later. An older version asks you to update the package instead of opening it.
What a filter can read
Section titled “What a filter can read”A filter is checked for each row. It can compare:
- a field on the row, such as
Contacts.LastName; - a field on the row’s parent, such as
Contacts.ReportsTo.LastNameorContacts.Account.Industry; - the record ID in a lookup, such as
Contacts.OwnerId; - a field on the main record, such as
Account.Industry; - a field on the outer repeat, when this repeat sits inside another one.
Filters work the same in the PDF, in Word and in the editor preview. The Filter field picker lists fields around the repeat but not the row’s parents, so type a parent field by hand. If a filter uses something the document cannot read (a field that does not exist, a path more than five levels up, or a field you do not have access to), Sliick Docs stops the save and names the field and where it can be used.
Show if
Section titled “Show if”A Show if block shows its contents only when its condition is true. Sliick Docs checks the condition when you save, and if something is wrong, a plain-English message appears on the right.
| To check | Example |
|---|---|
| Greater or less than | Account.AnnualRevenue > 1000000 |
| Equal to | Account.Industry = 'Technology' |
| Not equal to | Account.Industry != 'Healthcare' |
| Contains | Account.Name contains 'Acme' |
| Both are true | Account.IsActive = true AND Account.AnnualRevenue > 1000000 |
| Either is true | Account.Industry = 'Technology' OR Account.Industry = 'Software' |
| Not true | NOT Account.Industry = 'Healthcare' |
| Grouped | (Account.Industry = 'A' OR Account.Industry = 'B') AND Account.Amount > 1000000 |
| Field is empty | Account.Description = null |
| Has related records | COUNT:Opportunities > 0 |
| Total of related records | SUM:Opportunities.Amount > 10000 (also AVG, MIN, MAX) |
How to write a condition:
- Comparisons:
=,!=,>,>=,<,<=andcontains.containsignores capitals. - Put text in single quotes:
'Technology'. - Numbers can have decimals and can be negative. You can also use
true,falseandnull(empty).
A condition can read the main record, its parents (Account.Owner.Name) and lookup IDs. Inside a repeat, it can also read the current row and the rows of any repeat around it.
Shortcut inside a repeat: you can leave off the list name. In a repeat over Contacts, Title = 'CEO' means Contacts.Title = 'CEO'. This works the same in the PDF, in Word and in the preview. If the name does not match a field on the row (for example a typo, or a field from an outer list), Sliick Docs stops the save.
Conditions on a related list belong inside a repeat
Section titled “Conditions on a related list belong inside a repeat”A condition such as Contacts.LastName = 'Smith' placed outside a repeat over Contacts has no single contact to check, so Sliick Docs stops the save with this message:
Change the condition: Contacts.LastName is on the related list Contacts, and a condition can only read a related list inside a repeat over it. Move the conditional block inside a repeat over Contacts, or test the list itself with COUNT:Contacts > 0.
A draft with a condition like this shows as not valid until you fix it.
Approval history is the exception to the COUNT advice. Totals over approvals are not supported, so COUNT:Approvals and the other totals over approvals are refused. To show approvals, use a repeat over Approvals instead.
The else part
Section titled “The else part”A Show if block can have an else part: one set of content shows when the condition is true, and a different set when it is not. Click Add an else branch to add it. This saves you keeping two blocks with opposite conditions in step.

Editing in the else part works like anywhere else: duplicate, add a block after, and move all stay within it, and merge fields there are checked like the rest of the document.
Note: bundles use the same condition rules to decide whether to include an item. See Multi-template bundles.